4,305 Posted Topics

Member Avatar for peaceofmind
Member Avatar for vegaseat
0
178
Member Avatar for peaceofmind
Member Avatar for Micko

Python is actually compiled to a byte code and then interpreted. If you want to hide your source file, you can send these byte code files (extension .pyc) along with a version of Python called movable Python that does not have to be installed. An alternate solution is a program …

Member Avatar for vegaseat
0
310
Member Avatar for luxnova

My suggestion would be to read the thread called Starting Python right on this website, particularly the first entry. To create a subdirectory, Windows uses the term subfolder, you can actually use Python. Let's assume you have a Windows box and have Python installed in in a directory/folder called C:\Python24 …

Member Avatar for vegaseat
0
146
Member Avatar for faisyshah

The problem with google is that it gives you 99% BS. Try: [url]http://computer.howstuffworks.com/[/url] for only 77% BS. Darn, one of the little guys just fell out of the side of my PC. Got to use more duct tape! Also: [url]http://www.geocities.com/basicsofcomputing/index.htm[/url]

Member Avatar for tayspen
0
448
Member Avatar for vegaseat

Does anybody know the weight of a grain of rice? I am into Ethiopian cooking.

Member Avatar for YoungCoder
0
681
Member Avatar for luxnova

PYTHONPATH is installed by the python installer package (python-2.4.1.msi or python-2.4.1.exe) that you hopefully downloaded from: [url]http://www.python.org[/url] This program will show you the path ... [code]import sys print sys.path [/code] The result will be a list looking something like that: [code]['D:\\Python24\\Atest', 'D:\\Python24\\python24.zip', 'D:\\Python24\\Atest', 'D:\\Python24\\DLLs', 'D:\\Python24\\lib', 'D:\\Python24\\lib\\plat-win', 'D:\\Python24\\lib\\lib-tk', 'D:\\Python24', 'D:\\Python24\\lib\\site-packages', 'D:\\Python24\\lib\\site-packages\\Numeric', …

Member Avatar for vegaseat
0
293
Member Avatar for danizzil14

This is a nice beginners tutorial and has a decent section on classes in it: [url]http://www.byteofpython.info/[/url] As the complexity of your programs increase, classes come handy. In simple words, a class groups functions together and gives the functions (now called methods) additional idendity, a way to pass parameters amongst themselves …

Member Avatar for vegaseat
0
157
Member Avatar for mccarthp

You need to post an example code of one of your typical scripts, otherwise I am lost!

Member Avatar for mccarthp
0
228
Member Avatar for danizzil14

At first glance it looks like you are trying to multiply two strings. This is what you get from an entry field. Put a float() around each.

Member Avatar for vegaseat
0
178
Member Avatar for danizzil14

Py2Exe is not the smoothest thing to work with, but here is a step by step: [url]http://www.pharscape.org/index.php?option=com_content&task=view&id=33&Itemid=51[/url] There is also "Movable Python" for USB Flash Cards: [url]http://www.voidspace.org.uk/python/movpy/[/url] movpy-0.4.6-2.4-standard.zip contains Python 2.4 Psyco 1.4 wxPython - wx-2.5.3-msw-unicode SPE 0.7.2b IPython 0.6.10 readline (by Gary Bishop) 1.12 ctypes 0.9.2

Member Avatar for vegaseat
0
171
Member Avatar for G-Do

I have just played a little with your code. I see what you mean. My solution would be to put the "tk>>" prompt in a label in front of the enter field and combine the two texts when the enter key is pressed. Nice code by the way!

Member Avatar for G-Do
0
2K
Member Avatar for nephish

I started out with Tkinter for my GUI stuff, but tend to use wxPython more and more. wxPython is more up to date (more fancy widgets) and gives me more control over the placement of the widgets/components.

Member Avatar for nephish
0
209
Member Avatar for nephish

I have seen Java Scripts that are browser specific and need all sorts of rewrites/options depending on the detected browser.

Member Avatar for nephish
0
177
Member Avatar for shanenin
Member Avatar for shanenin

Thanks G-Do for your excellent sample code and the references. Good sample code seems to be missing with most common Python tutorials.

Member Avatar for vegaseat
0
349
Member Avatar for shanenin

Typing help('FileDialog') or help('tkFileDialog') in the Python shell will bring up the details. I am still looking for a good example. This is all I have ... [code=python]#from Tkinter import * import tkFileDialog help('tkFileDialog') #root = Tk() filename = tkFileDialog.askopenfilename() print filename #root.mainloop() [/code] You can uncomment the code. It's …

Member Avatar for vegaseat
0
165
Member Avatar for shanenin

The last three lines of your code are equal to writing ... [code] Player().blast(Alien()) [/code] Maybe this shows the connection a little better. Player().blast has the line enemy.die() in it. We tell blast that the enemy is the Alien(), so it calls Alien().die(). BTW, the print statement with the three …

Member Avatar for Walrus Bites
0
264
Member Avatar for zeek

I did something along this line with large factorials and stored the results in character arrays. It is written in C++ but does not use any C++ specific features. So it is "almost C" ... [url]http://www.daniweb.com/code/showsnippet.php?codeid=233[/url]

Member Avatar for vegaseat
0
284
Member Avatar for bumsfeld

Python does make it look simple ... [code=python]# day of the week of a given date # date.weekday() returns 0 for Monday and so on, so pick the string from a list from datetime import date oldDate = date(1911, 11, 11) # year, month, day dayofWeek = ['Monday', 'Tuesday', 'Wednesday', …

Member Avatar for vegaseat
0
239
Member Avatar for zauber

I have worked with modelbrot sets before, just recently with this example, maybe you can apply the algorithm ... [code=python]## example of how Numeric, Tkinter, and PIL can be used ## together to create all sorts of images, in this case the Mandelbrot set ## used the Numerical python text …

Member Avatar for vegaseat
0
151
Member Avatar for reezin14

Take a look at: [url]http://www.python.org/moin/IntroductoryBooks[/url] The Borders bookstore in my town generally has a fair selection of Python books. I use mostly online info and forum help for my learning process.

Member Avatar for shanenin
0
252
Member Avatar for Walrus Bites

The closest thing to this is Py2Exe. It combines all the needed files into one executable. Google for Py2Exe.

Member Avatar for shanenin
0
276
Member Avatar for Rearden

I don't have a Linux Box, but if there is a program that plays wave files you could call it with system(). Something like [code] system("WavePlayer cat.wav") [/code]

Member Avatar for Rearden
0
327
Member Avatar for fanfan1313

The problem with the standard helpfile at: [url]http://www.python.org/doc/2.3.5/lib/lib.html[/url] is the lack of examples. The few examples given are dreadful at best, and many are littered with those blurring >>> prompts. Yes, a wiki with helpful code snippets would be very nice. However, you need a good way to reference and …

Member Avatar for fanfan1313
0
195
Member Avatar for mattd2

This works fine ... [code]import time timeTuple = (2005, 7, 24, 15, 32, 0, 6, 205, 0) print "MM/DD/YYYY HH:MM:SS =",time.strftime("%m/%d/%y %H:%M:%S", timeTuple) [/code] There must be something wrong with i.issued, you can force it to be a tuple with tuple(i.issued). You can create this timeTuple with ... [code]timeTuple = …

Member Avatar for vegaseat
0
1K
Member Avatar for bandm

The C++ help file from Borland is pretty much what you want. It has a fine index, crossreference and lots of code samples. You can download it for free from the Borland website. It is named: bcpp.hlp

Member Avatar for Narue
0
185
Member Avatar for mattd2

Sounds like the function repr() might just do the trick ... [php]str1 = 'http://www.url.com/to/rss.feed' print str1 # result = http://www.url.com/to/rss.feed print repr(str1) # result = 'http://www.url.com/to/rss.feed' [/php]

Member Avatar for mattd2
0
312
Member Avatar for bandm

Just a hint, on your parallel resistor calculator declare both R1 and R2 as a float or something like: R1 = 1 R2 = 2 will give you a parallel resistance of 0 BTW, the Windows snippet you have is the one that comes up with DevCpp when you create …

Member Avatar for vegaseat
0
287
Member Avatar for brycegordon

Look at this way, it's like learning to read. First you read each character, then each word, then perhaps an entire sentence. If you want to do GUI (the windows and button thingy) programming with C++, you got to be able catch entire paragraphs at a glance, or the amount …

Member Avatar for vegaseat
0
387
Member Avatar for madgokuss4

Since there is little information, I am assuming Windows XP, Tkinter GUI, and Python code client. Let's say your client code is saved as Client1.py to the working folder and might look like this ... [code=python]# print out a given year's monthly calendars import calendar calendar.prcal(2005) # optional console wait …

Member Avatar for vegaseat
0
145
Member Avatar for G-Do

Have you done your required reading on sockets yet? Here is one article ... [url]http://www.devshed.com/c/a/Python/Sockets-in-Python/[/url] Also look at the two websites that come up when you run help('urllib')

Member Avatar for G-Do
0
250
Member Avatar for peaceofmind

Can you give us the error message and a little more of your code? Without that info, I don't know what your resultset looks like. I can only assume that mp3id could be an integer and needs to be converted to a string to work with the + concatination. In …

Member Avatar for peaceofmind
0
209
Member Avatar for chriswell

[QUOTE=1o0oBhP]fair enough. Im used to Programming in VB (6 years and before i learned c++) where you can observe variables at run time (ie wats in the string). however my c++ IDE doesnt.... so i dont know what is going on i have to make certain nothing can go wrong …

Member Avatar for bgunn
0
218
Member Avatar for Kob0724

One improvement would be to avoid all those exposed globals, a major source of problems in any program. You got to learn to pass these variables properly to and from functions. Hey, it's a start, congratulations!

Member Avatar for Kob0724
0
333
Member Avatar for shakesahal

I remember from my Borland days that these precompiled header files are gigantic and exercise the disk drive well. They do accumulate with time. Maybe you are out of disk space?!

Member Avatar for shakesahal
0
207
Member Avatar for shanenin

For file copy shutil.copy2( sourcefile, destinationfile) is preferred, since it retains the last access time and last modification time of the file.

Member Avatar for shanenin
0
248
Member Avatar for shanenin

Where there is a geteuid(), there is seteuid(userid_data). Unfortunately I can't play with it, since I don't have a Unix machine.

Member Avatar for vegaseat
0
344
Member Avatar for danizzil14

Check the Python online book/tutorial at: [url]http://www.byteofpython.info/[/url] If you are using IDLE and press the F1 key you bring up the Python Documentation which has a lengthy Tutorial in it. Why are you excluding the 31 to 39 age in your poll?

Member Avatar for danizzil14
0
149
Member Avatar for Flinch

The mode you are trying to set in ... [code]screen = pygame.display.set_mode((468, 60)) [/code] is really not very close to any recognizable mode. Pygame does search for the closest possible mode, but may be overtaxed in this case!

Member Avatar for vegaseat
0
745
Member Avatar for iacobus2

I have to agree with you, good sample code would be nice. I do dislike anything more than "one liners" written on the interactive page, it's just too confusing. Tutorials are used mostly by beginners, looks like Guido has forgotten what it is to be a beginner! Look at it …

Member Avatar for shanenin
0
204
Member Avatar for madgokuss4
Member Avatar for danizzil14

This snippet will bring up a message window using Toplevel() ... [code=python]# display message in a child window from Tkinter import * def messageWindow(message): # create child window win = Toplevel() # display message Label(win, text=message).pack() # quit child window and return to root window Button(win, text='OK', command=win.destroy).pack() def createMessage(): …

Member Avatar for vegaseat
0
177
Member Avatar for danizzil14

Check this code, you may be able to use portions for your project ... [php]# Tkinter, explore the entry field from Tkinter import * def show(): # clear the label label2.config(text='') # get the enter1 text and show it in label2 label2.config(text='Hello ' + enter1.get()) # create root window root …

Member Avatar for vegaseat
0
162
Member Avatar for danizzil14

On Windows run cmd.exe and at the console command prompt type something like: python mypyfile.py that should run the file. If Python has been properly installed and registered with the operating system, it should find python.exe. I really like to run my code from a Python based IDE like IDLE, …

Member Avatar for vegaseat
0
168
Member Avatar for shanenin

Depends on the way you are calling the class, look at it this way (check my comments) ... [php]class Critter: def __init__(self,name): print "I am born" self.test = name print self.test def talk(self): print 'ya' crit = Critter('ralph') # like calling Critter.__init__('ralph') crit.talk() # like calling Critter.__init__('ralph').talk() [/php] If you …

Member Avatar for vegaseat
0
213
Member Avatar for nephish

You are getting into some pretty fancy coding! Nice to let us know what you are doing! May the power of Python be with you!

Member Avatar for nephish
0
151
Member Avatar for Rete

You can split the string into a list of words at a whitespace (space, spaces, tab, newline) ... [code]# convert a string to a list of words str1 = 'You never find a missing item until you replace it' print "Original string:" print str1 # split the string into a …

Member Avatar for Rete
0
164
Member Avatar for Rete

I wrote this little function in Python. It scans a string and returns True the moment it finds a capital letter, otherwise False. Hope this helps ... [code=python]# tested with Python24 def hasCap(s): """returns True if the string s contains a capital letter""" for num in range(65, 91): # A …

Member Avatar for Rete
0
228
Member Avatar for shanenin

Looks like you put a lot of thought and effort into this game. Something is lousing up the indentations in the php-codefield, did you mix spaces and tabs? I would highly recommend to stick with spaces only, since tab settings can differ from one computer to the other. Looks like …

Member Avatar for vegaseat
0
1K

The End.