4,305 Posted Topics
Re: You can use Hide and Show, here is an example ... [code=python]# create two frames with wxFrame, only one is showing import wx class Frame1(wx.Frame): def __init__(self, parent, mytitle): wx.Frame.__init__(self, parent, -1, mytitle) self.SetBackgroundColour("green") # pass frame1 to frame2 as instance self self.frame2 = Frame2(None, 'Frame2', self) # create input … | |
Re: Oh yes, the well ordered world of random numbers. The casinos couldn't live without. | |
![]() | Re: Your problem can best be solved by going to GUI programming (has an event loop) and have the user click a button to quit. |
Re: Take a look at: [url]http://www.crummy.com/software/BeautifulSoup/[/url] | |
Re: Is your Zope version for Python24 or Python25? | |
Re: The values you gave are not really printable characters, but in general ... [code=python]c = "%s" % '\x1a' print c [/code] | |
Re: Judging from the traceback, there could be an font file you don't have. Another potential reason could be that you are using Tkinter and PIL together and get the "Image" namespace conflict due to the way you import the modules. | |
Re: Put the proper code inside the loop and it will work ... [code=python]fout = open("pa16names.txt", "w") while True: name = raw_input("Enter your name (just Enter to exit): ") fout.writelines(name + '\n') if name == "": break fout. close() print fin = open ("pa16names.txt", "r") print "The names you've entered into … | |
Re: Generally, to find the difference of two texts you can use Python module difflib ... [code=python]# use Python module difflib to find the line by # line differences between two texts # modified to work with Python25 and Python30 """ line markers ... '- ' line unique to sequence 1 … | |
Re: Looks like WinZip is screwing around with their '.zip' format making the files incompatible with different versions of WinZip and other products like WinRAR and 7Zip. Stay away from WinZip and use something more modern like WinRAR. I brought up the issue in the ModChamber. In the meantime compress to … | |
Re: You could do it as simple as this ... [code=python]html_str = """\ <html> <head> <title>Bring up an image with sound</title> </head> <body> <IMG SRC="train.bmp" WIDTH=320 HEIGHT=210 BORDER=5> <bgsound src="train.wav" loop=2> </body> </html> """ tag_close = html_str.count('</') # each close tag also has an open tag, so deduct it tag_open = … | |
Re: About as practical as a Hummer. For those of us who throw their remote at the TV during a bad program or a losing sports game, this one will bounce right back! | |
![]() | Re: First of all do not use 'str' as a variable name, it is a Python function. Here is an example of the loop ... [code=python]mystr = "aasd<script>" for c in mystr: if c == '<': break else: print(c) [/code] |
![]() | Re: subprocess.call(["program-name", "arg1", "arg2"]) takes an executable program with arguments. You are giving it an html script code. That won't work! |
![]() | Re: If you have the Windows OS, here is an example ... [code=python]# change color in the python.exe console display (Windows) # color is a two digit hexadecimal number # the first digit is the background # the second digit is the foreground (text) # 0=black 1=blue 2=green ... to E=yellow … ![]() |
Re: For Windows download the installer: setuptools-0.6c9.win32--py2.5.exe After installation you find easy_install.py in directory: C:\Python25\Lib\site-packages\setuptools\command | |
Re: The Tkinter GUI toolkit is simple enough and comes with most Python installations. For typical example take a look at: [url]http://www.daniweb.com/forums/post888276.html#post888276[/url] | |
Re: Ignorance is bliss Apathy is a mental illness | |
Re: I think he used to believe in evolution, but now believes in creationism. Changing your mind is the prerogative of old folks. | |
![]() | Re: Firstly note that 'file' is a Python function name and should not be used for a variable name! Python has module linecache to do what you so desire ... [code]import linecache filename = "html.html" # read a selected line (first line is 1) # note that each line will have … |
Re: The only perfectly empty space I know of, is in the cranium of certain politicians. Yes, in that space many scientific laws malfunction. | |
Re: [QUOTE=sneekula;885091]The { and } keys.[/QUOTE]Hmm, maybe you inherited the keyboard from a Pascal, Java, C#, C or C++ programmer. My first intro to the {} pair was with Pascal comments. On my own keyboard it must be the space bar. Any lettering is totally worn off! :) | |
Re: Looks like it depends what your encoding type is set to. Your server or your editor may do the encoding for you. When I use your 'grab the page data from WoWArmory' code with the DrPython IDE, I get the proper special characters you want in its output window. My … | |
Re: Try something like this ... [code=python]def extract(text, sub1, sub2): """ extract a substring from text between first occurances of substrings sub1 and sub2 """ return text.split(sub1, 1)[-1].split(sub2, 1)[0] text = '<SYNC Start=106377><P Class=ENCC>' timestamp = extract(text, 'rt=', '><') filename = 'grey-anatomy_' + timestamp + '.bmp' # test it ... print(filename) … | |
Re: What is your error message? Do you have the module psychopy and module numpy installed on your PC's version of Python? These two modules do not normally come with the Python installation, and have to be downloaded separately. | |
| |
Re: For what you have in mind you need to use a list, not a string ... [code=python]mylist = ['Corn', 'For', 'Grain', 'Irrigated', '1970', 'Colorado', 'Chaffee', '8', '10', '15', '11199199', '1', '100', 'acres', '75', 'bushel', '7500', 'bushel'] acres = int(mylist[-6]) bushel1 = int(mylist[-4]) bushel2 = int(mylist[-2]) print acres, bushel1, bushel2 # … | |
![]() | Re: Even if you use the modified code below, it will take almost forever ... [code=python]import random import string combos = list(string.ascii_lowercase + string.digits) #log=open('log.txt','r') #search = read_log=log.read() # for test only search = 'killzone2' combo = '' while combo != search: # build up string combo the same length as … |
Re: Hey Snee, very interesting use of whitespace to make the quiz dictionary easier to construct. | |
Re: Here is a cute example of the use of a Python class. It shows you how the class is used to group functions/methods together, and how one class can inherit another class or multiple other classes ... [code=python]# basic experiments with Python class class Cat(object): # this is public cost … | |
Re: If carbon would be all bound in solid insoluble rock, there wouldn't be any life. | |
Re: A dialog window may be all you need. | |
Re: wx.ALIGN_CENTER_VERTICAL in the sizer associates with the radiobox widget and not the individual radiobuttons in the widget. You have to change the style in radiobox to get a row or column layout for the radiobuttons. | |
Re: Here is one way to do this ... [code=python]# use Tkinter's dialogs to ask for input # dialogs are askfloat, askinteger, and askstring import Tkinter as tk from tkSimpleDialog import askinteger def get_age(): # keeps asking until you enter an integer value age = askinteger("Age", "Enter your age") int_var.set(age) root … | |
Re: Take a look at: [url]http://www.logilab.org/project/pylint[/url] | |
Re: PyMedia is a little old and crusty, development seems to have stopped in June 2006. | |
Re: Here is an example ... [code=python]# disable a Tkinter button for a set time import Tkinter as tk def disable(): # 'normal' enables button again button['state'] = 'disabled' # enable button again after 3000 milliseconds button.after(3000, enable) def enable(): button['state'] = 'normal' root = tk.Tk() # disabled only works with … | |
Re: Actually, compared to US political standards the amounts in question are pitifully small. | |
Re: There is always room for young C/C++ programmers, as the old ones forget how to do it. | |
Re: Python would make this easily possible, but you need to tell us if ARG always turns into ARG1, or is the next ARG a ARG2 and so on? | |
Re: wxPython has its own wait/delay functions: wx.Sleep(seconds) wx.MilliSleep(milliseconds) The best way is to use wx.FutureCall(), for an example see: [url]http://www.daniweb.com/forums/showpost.php?p=872314&postcount=108[/url] | |
Re: Another rather meaningless question for spamming use. Don't bother to answer this one! | |
Re: [QUOTE=woooee;873192]Please don't spam this site or someone will report you and you will be banned. Since the OP didn't say which toolkit or OS was involved, it is obvious that there is no way to recommend anything, hence MESHIKUMAR and mohankumar554 are the same and are spamming.[/QUOTE] Thanks woooee! I … | |
Re: If you change the print statement to a print() function you can do about 95% of the older sample code with Python3. Actually the print() function was there for Python25. Also, with Python3 the old raw_input() for strings is now input() for strings. So, go ahead and use the older … | |
Re: Looks to me that you are using operations for sets like copy() and add() with lists. | |
![]() | Re: Your problem is that readlines() attaches the newline character if present ... [code=python]password = open('passwords.txt') username = open('usernames.txt') #each line in passwords.txt will have another passwords password_list = password.readlines() username_list = username.readlines() # for test print only ... print password_list # notice the attached '\n' characters!!!! print username_list guessuser = … ![]() |
Re: Thanks for the information. Have you worked with CherryPy? | |
Re: I remember trying to write a "Boa for Dummies" blow by blow instruction. Take a look at: [url]http://www.daniweb.com/forums/post400296-107.html[/url] It should at least give you a taste what things you are up to with a designer for your GUI programs. Believe me, Boa is one of the friendlier ones. A while … |
The End.