988 Posted Topics

Member Avatar for frijole

There is a simplifying wrapper for pygame called gasp. You need pygame installed first for this to work: [code=python]# using module gasp to draw an arc, a box, plots and circles # # info: GASP (Graphics API for Students of Python) # A library built on pygame that enables absolute …

Member Avatar for frijole
0
184
Member Avatar for athirar

I don't think it has much to do with the size of the list, you are simply going past the number of indexed elements. Look at this example: [code=python]my_list = [1, 2, 3, 4] print my_list[4] # IndexError: list index out of range [/code]

Member Avatar for kdoiron
0
118
Member Avatar for Shadow14l

Here is an example to make the tk window disappear: [code=python]import Tkinter as tk import tkFileDialog root = tk.Tk() # show file dialog without Tkinter window root.withdraw() filename = tkFileDialog.askopenfilename() print filename [/code]To see the code tags around this code, temporarily click on the "REPLY W/QUOTE" button.

Member Avatar for Shadow14l
0
245
Member Avatar for tondeuse34
Member Avatar for hilarybrobbey

You must not have installed tkSnack properly. For instance open the zip file snack2210-py.zip and extract file tkSnack.py to C:\Python24\Lib and the folder snacklib to C:\Python24\tcl

Member Avatar for Ene Uran
0
83
Member Avatar for The Dude
Member Avatar for jephthah
0
263
Member Avatar for majestic0110
Member Avatar for mattyd

Talking about poor churches there is one of the many in my neighborhood: [url]http://www.crystalcathedral.org/visitors/[/url]

Member Avatar for ~s.o.s~
3
10K
Member Avatar for SUBHABRATAIISC

I am not quite sure what you mean with store, If you mean store in a string, there are these ways: [code=python]a=['city','village','town','capital'] a1=len(a) a2=range(a1) s = "" for x in a2: a3=a[x] print a3 s += a[x] print s # cityvillagetowncapital [/code]Much simpler: [code=python]a=['city','village','town','capital'] s = "" for x in …

Member Avatar for Ene Uran
0
86
Member Avatar for Tyrfing

In your scipy directory there is the package init file __init__.py and there also should be a __config__.py file. If not, you may have to reinstall or run the setup.py program. [code]python setup install [/code]

Member Avatar for Tyrfing
0
2K
Member Avatar for urmybaby

CSV files are generated by spread sheet programs. Rows make a line in the file and the data columns are separated by commas. Python has a module called csv that makes processing this type of file much easier. Check the Python manual.

Member Avatar for kdoiron
0
85
Member Avatar for maui_mallard

In a similar vain, I have 678 posts right now and should have 679 after this post. Wow, there is excitement in life after all!

Member Avatar for jbennet
2
311
Member Avatar for DangerDev

[QUOTE=jwenting;526374]Google said so...[/QUOTE]A beautiful come back! You are showing the witty side of yourself there JW. I have friends that work at MS, and they claim that they already have a great search engine in house. Looks like Yahoo might just be market share.

Member Avatar for sneekula
0
582
Member Avatar for vegaseat

We learned that it is only used for function arguments, and ** indicates a dictionary of variable number of key:val arguments.

Member Avatar for a1eio
0
212
Member Avatar for briansmall
Member Avatar for Mackjan

Something like this might do it: [code=python]import random def dela(x): sum=0 mylist = [] while sum < x: b = random.randrange (1, x - sum + 1) mylist.append(b) sum = sum + b #print b, return sum, mylist # test it ... sum, mylist = dela(5) print mylist # eg. …

Member Avatar for Mackjan
0
85
Member Avatar for The Dude
Member Avatar for twomers
0
117
Member Avatar for GrimJack

I don't see any new avatars. Just a couple of old ones that have been adopted.

Member Avatar for majestic0110
0
312
Member Avatar for zandiago

The mild way to deal with Telemarketers is to say: "Just a moment, I will get my mother." Lay the phone on the table and let them wait, waste their time, they will eventually hang up. Wait a minute, that could be a nice new thread.

Member Avatar for jbennet
0
862
Member Avatar for kv79
Member Avatar for Chunkymonkey

First you have to get the basic design of the deck and the hand of cards down: [code=python]# basic design of a card game using Python import random def show_hand(hand): """give drawn cards more detailed descriptions and then display""" for item in hand: rank = item[0] suit = item[1] if …

Member Avatar for Chunkymonkey
0
184
Member Avatar for techbound
Member Avatar for majestic0110
Member Avatar for Ene Uran
0
128
Member Avatar for urmybaby
Member Avatar for Ene Uran
0
143
Member Avatar for Stefano Mtangoo

Read line 8 and 9, you got to have the properly named icon image file for this to work.

Member Avatar for Stefano Mtangoo
0
245
Member Avatar for GrimJack

I guess whether or not you like a commercial is still a matter of taste. I think commercials make watching TV at least a little interesting.

Member Avatar for GrimJack
0
132
Member Avatar for nsandestin

If it's like the like() function in VB, then you can do it with module re, which does have wildcard and characterlist patterns.

Member Avatar for nsandestin
0
121
Member Avatar for linux

Did you see vegaseat's post in "Starting Python" about using module pyglet to sound off a series of wave files? See: [url]http://www.daniweb.com/forums/post590403-133.html[/url]

Member Avatar for Ene Uran
0
85
Member Avatar for wyno

[QUOTE=scru;592378]Every three days? Consider yourself lucky and let's leave it at that.[/QUOTE]I agree, my cplusplus eats two rats a day, and I had to move to the inner city so it wouldn't starve!

Member Avatar for Ene Uran
0
88
Member Avatar for heshan

In a nutshell: [code=python]def add(a, b): return a + b var = 2 str = "var = add(2, 3)" # execute the code snippet inside the str string variable exec(str) print var # --> 5 [/code]

Member Avatar for Ene Uran
0
109
Member Avatar for The Dude
Member Avatar for berserker

Your exploration could aid other folks. Just remember that Python style recommends to have class names begin with upper case and function/method names to begin with a lower case letter.

Member Avatar for Ene Uran
0
160
Member Avatar for G-Do

Nice code G-Do. I added default dimensions and also added "(wait 2 to 3 minutes to show)" to the title to assist the impatient user.

Member Avatar for nish88
0
116
Member Avatar for gehher
Member Avatar for pythonuser

Do you just want to know if they are equal? If that is the case, you can simply use: [code=python]# compare two files and check if they are equal # files can be binary or text based import filecmp # pick two files you want to compare ... file1 = …

Member Avatar for bodhankaryogesh
0
274
Member Avatar for The Dude

Now you know why so many folks watch TV because of the commercials rather than the lousy content of the program.

Member Avatar for kylethedarkn
0
63
Member Avatar for Jimbo43

Please use code tags around your Python code to preserve the proper indentations. Check the message in the background of the Quick Reply message box for the code tags.

Member Avatar for Jimbo43
0
2K
Member Avatar for The Dude
Re: Hehe

Only in Japan would folks be polite enough not to kill this dude.

Member Avatar for The Dude
0
29
Member Avatar for Shakis

If you insist on giving each entry field a recognizable name, you can try this: [code=python]# create named multi entries in Tkinter import Tkinter as tk class MyFrame(tk.Frame): """ entries are in the same grid """ def __init__(self, master): tk.Frame.__init__(self, master) words = ["one","two","three","four","five","six","seven","eight","nine"] # create a list of entries …

Member Avatar for Shakis
0
80
Member Avatar for crackers

Give this a try: [code=python]import random data = ["apple", "orange", "melon", "pear"] # this picks one item from the list above print random.choice(data) [/code]

Member Avatar for crackers
0
156
Member Avatar for sicantik03

Please use code tags to mainain proper Python indentations! [code=python]def my_f(modelfilename): modelfile = open(modelfilename) modelline_list = modelfile.readlines() modelfile.close() itemY = ["lol", "young", "HoLa", "...", "Yum!", ":o)", "blokes", "!!!", "hello"] itemO = ["old", "yes", "Mom", "serious", "blog"] for line in modelline_list: for itemy in itemY: if itemy in line: print "+1 …

Member Avatar for woooee
0
141
Member Avatar for killingcheese

I think vegaseat had this posted some time ago, read the comments for instructions: [code=python]# Py2Exe version 0.6.3 setup file for console programs. # # If this is a windows GUI application replace the last line with # windows = [{"script": 'myFile.py'}] ) # # Enter the file name of …

Member Avatar for jaux
0
120
Member Avatar for The Dude
Member Avatar for valorien

Give module subprocess a try, it's a bit more advanced: [code=python]import subprocess # execute the code and pipe the result to a string test = "ping xxx.xxx.xxx.xxx" process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE) # give it time to respond process.wait() # optional check (0 --> success) print process.returncode # read the …

Member Avatar for Ene Uran
0
1K
Member Avatar for ChrisRiv91

With Python you can use the slicing operator to help out: [code=pyton]t1 = '1230' # --> 12:30 t2 = '100' # --> 1:00 # slicing operator seq[begin : end : step] # step is optional # defaults are index begin=0, index end=len(seq)-1, step=1 # -begin or -end --> count from …

Member Avatar for Ene Uran
0
864
Member Avatar for vegaseat
Member Avatar for fongoos

The proof is in the pudding. Take a small project like creating a monthly calendar and try to do it with Java and then with Python.

Member Avatar for linux
0
823
Member Avatar for rt7878
Member Avatar for sneekula
0
159
Member Avatar for The Dude
Member Avatar for Defcon106

There are 2 versions of Python available than can run from a USB thumbdrive. One is MovablePython and th other PortablePython, the last one is free and the first one cost just a small amount (its older Python24 version is a free download however, so you can evaluate).

Member Avatar for Defcon106
0
76

The End.