4,305 Posted Topics
Re: This is tough! I simply don't have enough information to help you. | |
| |
Re: 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 … | |
Re: 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 … | |
Re: 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] | |
Does anybody know the weight of a grain of rice? I am into Ethiopian cooking. | |
Re: 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', … | |
Re: 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 … | |
Re: You need to post an example code of one of your typical scripts, otherwise I am lost! | |
Re: 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. | |
Re: 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 | |
Re: 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! | |
Re: 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. | |
Re: I have seen Java Scripts that are browser specific and need all sorts of rewrites/options depending on the detected browser. | |
Re: What video file format are you talking about? | |
Re: Thanks G-Do for your excellent sample code and the references. Good sample code seems to be missing with most common Python tutorials. | |
Re: 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 … | |
Re: 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 … ![]() | |
Re: 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] | |
Re: 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', … | |
Re: 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 … | |
Re: 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. | |
![]() | Re: The closest thing to this is Py2Exe. It combines all the needed files into one executable. Google for Py2Exe. |
Re: 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] | |
Re: 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 … | |
Re: 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 = … | |
Re: 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 | |
Re: 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] | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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') | |
Re: 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 … | |
Re: [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 … | |
Re: 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! | |
Re: 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?! | |
Re: For file copy shutil.copy2( sourcefile, destinationfile) is preferred, since it retains the last access time and last modification time of the file. | |
Re: 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. | |
Re: 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? | |
Re: 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! | |
Re: 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 … | |
Re: 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(): … | |
Re: 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 … | |
Re: 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, … | |
Re: 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 … | |
Re: 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! | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … |
The End.