py2exe help
python help, I'm open for suggestions. I'm using py2exe to compile a working program. The program runs and prints fine until I compile it with py2exe. After compiling the program, it runs fine until it tries to import the win32ui module, v2.6214.0. Then, I get a windows error message: ImportError: Dll load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Anyone have the same problem with this?. jim-on linux -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe help
I appreciate the help, it's working. jim-on-linux jim-on-linux wrote in news:mailman.74.1273614703.32709.python-l...@python.org in comp.lang.python: python help, I'm open for suggestions. I'm using py2exe to compile a working program. The program runs and prints fine until I compile it with py2exe. After compiling the program, it runs fine until it tries to import the win32ui module, v2.6214.0. Then, I get a windows error message: ImportError: Dll load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Anyone have the same problem with this?. http://www.py2exe.org/index.cgi/Py2exeAndWin32ui Rob. -- http://mail.python.org/mailman/listinfo/python-list
py2exe users
I have used py2exe many times with success. My current program is completing as expected but the exe file fails to open. The output file states that _imaging_gif is missing. I can run the program ok with IDLE but after converting with py2exe, the exe file just sits there. I'm using 2.6 on win XP. Any Ideas? jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
load_dynamic(_name_, path)
Python help, In win32api line 10 is written: mod = imp.load_dynamic(__name__, path) traceback; ImportError: DLL load failed: The specified module could not be found. import imp is available, Where does load_dynamic(__name__, path) come from? jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems running on HP Intel duel core machine
On Thursday 11 December 2008 I wrote about the problem that I was having importing win32ui from within a program I wrote. This was happening only on some computers but not all. The win32ui module is used for printing. I never solved the problem until today. I installed only winXP on a hard drive and started from there. I ran my program and incurred an error message that a some of my clients were getting; importError: Dll load failed: The specified module could not be found. Next, I loaded the installation software that came with an HP OfficeJet. Problem Solved. Apparently HP software is installing a file or files that python does not contain( I had a client load python ), and py2exe is not including in its package. 'load_dynamic' help says this: (Note: using shared libraries is highly system dependent, and not all systems support it.) I wonder if they tried installing an HP? jim-on-linux http://inqvista.com py help, I produced a program that runs on windows. One client is using an HP machine with an Intel cpu E2200 @ 2.2ghz., and with .99 G ram. The machine is using Win XP Pro 32 bit OS with service pack 2 I ran Dependency Walker and everything is OK. I used py2exe to build the exe file with bundle files:1 and also 3, with the same traceback results. I created a test print module that imports both win32api and win32ui modules and its only job is to print a page of text. The first module that is imported is win32api. line 8 of that module adds to the path the module named 'win32api.pyd'. The import is is completed without error. The next module that is imported is win32ui. line 8 of that module adds to the path a module named 'win32ui.pyd'. The search for the win32ui.pyd module seems to be the cause of the problem. Traceback: ImportError: Dll load failed: The specified module could not be found. Both modules 'win32api.pyd' and win32ui.pyd are in the same directory. Below is a copy of the win32ui.py module. The only difference between this and win32api.py module is the name that is installed when creating the path. def __load(): import imp, os, sys try: dirname = os.path.dirname(__loader__.archive) except NameError: dirname = sys.prefix path = os.path.join(dirname, 'win32ui.pyd') #print py2exe extension module, __name__, -, path mod = imp.load_dynamic(__name__, path) ##mod.frozen = 1 __load() del __load The only difference I can find is that this program works fine on every machine that it is tried on except the HP duo core machine, with Intel E2200 cpu. Somehow the path is affected? I've tried all of the suggestions and checked a lot of things but I'm not there yet, Any suggestions would be helpful. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Problems running on HP Intel duo core machine
py help, I produced a program that runs on windows. One client is using an HP machine with an Intel cpu E2200 @ 2.2ghz., and with .99 G ram. The machine is using Win XP Pro 32 bit OS with service pack 2 I ran Dependency Walker and everything is OK. I used py2exe to build the exe file with bundle files:1 and also 3, with the same traceback results. I created a test print module that imports both win32api and win32ui modules and its only job is to print a page of text. The first module that is imported is win32api. line 8 of that module adds to the path the module named 'win32api.pyd'. The import is is completed without error. The next module that is imported is win32ui. line 8 of that module adds to the path a module named 'win32ui.pyd'. The search for the win32ui.pyd module seems to be the cause of the problem. Traceback: ImportError: Dll load failed: The specified module could not be found. Both modules 'win32api.pyd' and win32ui.pyd are in the same directory. Below is a copy of the win32ui.py module. The only difference between this and win32api.py module is the name that is installed when creating the path. def __load(): import imp, os, sys try: dirname = os.path.dirname(__loader__.archive) except NameError: dirname = sys.prefix path = os.path.join(dirname, 'win32ui.pyd') #print py2exe extension module, __name__, -, path mod = imp.load_dynamic(__name__, path) ##mod.frozen = 1 __load() del __load The only difference I can find is that this program works fine on every machine that it is tried on except the HP duo core machine, with Intel E2200 cpu. Somehow the path is affected? I've tried all of the suggestions and checked a lot of things but I'm not there yet, Any suggestions would be helpful. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems running on HP Intel duo core machine
Aaron, The TraceBack is : TraceBack: File win32ui.pyc, line 12, in module File win32ui.pyc Line 10, in _load ImportError: DLL Load Failed: The specified module could not be found. On Thursday 11 December 2008 14:58, jim-on-linux wrote: py help, I produced a program that runs on windows. One client is using an HP machine with an Intel cpu E2200 @ 2.2ghz., and with .99 G ram. The machine is using Win XP Pro 32 bit OS with service pack 2 I ran Dependency Walker and everything is OK. I used py2exe to build the exe file with bundle files:1 and also 3, with the same traceback results. I created a test print module that imports both win32api and win32ui modules and its only job is to print a page of text. The first module that is imported is win32api. line 8 of that module adds to the path the module named 'win32api.pyd'. The import is is completed without error. The next module that is imported is win32ui. line 8 of that module adds to the path a module named 'win32ui.pyd'. The search for the win32ui.pyd module seems to be the cause of the problem. Traceback: ImportError: Dll load failed: The specified module could not be found. Both modules 'win32api.pyd' and win32ui.pyd are in the same directory. Below is a copy of the win32ui.py module. The only difference between this and win32api.py module is the name that is installed when creating the path. def __load(): import imp, os, sys try: dirname = os.path.dirname(__loader__.archive) except NameError: dirname = sys.prefix path = os.path.join(dirname, 'win32ui.pyd') #print py2exe extension module, __name__, -, path mod = imp.load_dynamic(__name__, path) ##mod.frozen = 1 __load() del __load The only difference I can find is that this program works fine on every machine that it is tried on except the HP duo core machine, with Intel E2200 cpu. Somehow the path is affected? I've tried all of the suggestions and checked a lot of things but I'm not there yet, Any suggestions would be helpful. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Problems running on hp duo Pentium R processor
Python help, In September I wrote: I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duo core Pentium R processor E2200, 2.2G with .99g ram. Only on the new HP, when they try to print they get an import error; File win32ui.pyc line 12, in module File win32ui.pyc, line 10, in _load ImportError: DLL load failed: The specified module could not be found. It turns out that the E2200 processor is 64 bit architecture. What are my options? I've run DependecyWalker, They are using Win XP Service Pack 2 jim=on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems running on hp duo Pentium R processor
On Friday 05 December 2008 15:27, Kevin Kelley wrote: If they are running standard Win XP (Home or Pro), as opposed to 64-bit Win XP, then whether or not the CPU supports the IA64 instruction set really doesn't matter. As far as I know every Intel Core2 and Pentium Dual-Core CPU since ~ 2006 has supported 64bit instructions, even the Atom is 64bit. Also, the R is for Registered Trademark (of Pentium), it's not part of the name/model (http://ark.intel.com/cpu.aspx?groupId=33925). Kevin Kevin , I'm trying to find out why my program gets an import error on only one machine. Is there any problem with python running on a 64 bit Architecture machine or is it something specific to this one HP machine? None of my other clients have had this problem, nor have I on any machine that I've tried tested it on. jim-on-linux On Fri, Dec 5, 2008 at 2:02 PM, jim-on-linux [EMAIL PROTECTED] wrote: Python help, In September I wrote: I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duo core Pentium R processor E2200, 2.2G with .99g ram. Only on the new HP, when they try to print they get an import error; File win32ui.pyc line 12, in module File win32ui.pyc, line 10, in _load ImportError: DLL load failed: The specified module could not be found. It turns out that the E2200 processor is 64 bit architecture. What are my options? I've run DependecyWalker, They are using Win XP Service Pack 2 jim=on-linux -- http://mail.python.org/mailman/listinfo/python-lis t -- http://mail.python.org/mailman/listinfo/python-list
Problems running on hp dual core processor
Python help, I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duel core processor, 2.2G with .099g ram. On the new hp, when they try to print they get an import error; File win32ui.pyc line 12, in module File win32ui.pyc, line 10, in _load ImportError: DLL load failed: The specified module could not be found. The file is there The only difference I could find from their other machines is the processor. -- http://mail.python.org/mailman/listinfo/python-list
Problems running on hp dual core processor
Python help, I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duel core processor, 2.2G with .099g ram. On the new hp, when they try to print they get an import error; File win32ui.pyc line 12, in module File win32ui.pyc, line 10, in _load ImportError: DLL load failed: The specified module could not be found. The file is there The only difference I could find from their other machines is the processor. I would appreciate any help Jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: install py2exe in vista
On Saturday 21 June 2008 13:28, Herman wrote: I want to install it in vistahttp://www.daniweb.com/forums/thread130469.htm l#, but i get this message in the process: could not create... py2exe-py2.5 I forwarded your question but you may want to ask again at the link below. [EMAIL PROTECTED] jim-on-linux http://inqvista.com I press 'OK', then.. could not set key value python 2.5 py2exe-0.6.8 I press 'OK' again, then... could not set key value c:\Python25\Removepy2exe.exe -u c:\python25\py2exe-wininst.log The installation goes on and do something, run some postinstall script. I thought it should be ok, but i fail even creating a simple hello word exe. I get this message after i run python setup.py install: running install running build running install_egg_info Writing c:\Python25\Lib\site-packages\UNKNOWN-0.0.0-py2.5-eg g-info No output is created. Can I anyone help me with this? http://www.addthis.com/bookmark.php http://www.daniweb.com/forums/editpost.php?do=editp ostp=631985 -- http://mail.python.org/mailman/listinfo/python-list
Re: pyHook and py2exe
On Sunday 22 June 2008 10:40, Gandalf wrote: hi every one. I have program which uses this pyHook lib, and when I try to compile it using py2exe the pyhook don't work. it gives me no error. the program works fine beside the function of this lib. why does it append ? is their any solution? I would be glad to know if anyone ever experienced this problem and if he solve it eventually I forwarded your question but you may want to ask again at the link below. [EMAIL PROTECTED] jim-on-linux http:\\inqvista.com thanks -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: sorting a file
On Saturday 14 June 2008 03:15, Beema shafreen wrote: Hi all, I have a file with three columns i need to sort the file with respect to the third column. How do I do it uisng python. I used Linux command to do this. Sort but i not able to do it ? can any body ssuggest me I have used this method to solve similar problems. This is a consept of how to do what you want, but you will have to work a little to get it right. You might try something like this; Dict = {} ##create a dictionary make a list of all column3 values for loop colum3 values Make these values the key in a dictionary If the values are long, you can use the first 7 to 15 characters if you want. use this key to equal all the values in the other columns on the same row. Dict[column3] = column1, column2, column3 once the dictionary is made get the dictionary key x = Dict.keys() ## get the keys from Dict x.sort() # produce a sorted list of keys of column3 Loop these sorted keys to extract from the dictionary the values related to each jim-on-linux http://:inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: finding icons for Apps
Learn how to use Gimp, Make your own icons, of and from anything. You can use screen shots and picks from anywhere. Import your own photos and modify any pic however you want. Check them out, free download, tutorial. http://www.gimp.org jim-on-linux http://www.inqvista.com Sanoski wrote: This might be a dumb question. I don't know. I'm new to all this. How do you find icons for your programs? All GUI applications have cool icons that represent various things. For instance, to save is often represented as a disk, etc. You know, the small little picture references that give meaning to the phrase 'Graphical User Interface'. But I'm not a graphics artist! Drawing is simply one talent that skipped me completely. Where can I find icons to use with my programs? I don't even know how to search for them, because I'm not sure how to word it. I tried Googling various things: icons, software graphics, application icons, custom graphics, etc, etc. But I'm not getting much luck here you guys. Also, besides just finding a collection of various pre-made icons, who would I talk to to make me some original custom made icons? I'll look for hours and find one or two places, but they never respond to my messages, so I figure they must not do that kind of art work. I'm looking for both: a collection of graphics and some place (or someone) that can make custom original graphics. The latter is just for future reference. The more important one is the former, because I can't even afford to pay for originals right now. But maybe I will soon, so it would be nice to have a resource. Thanks in advance, Joshua http://tango.freedesktop.org/Tango_Desktop _Project http://www.oxygen-icons.org/ http://everaldo.com/crystal/ -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter, annoying grid-problem
On Friday 11 April 2008 18:41, [EMAIL PROTECTED] wrote: so my little calculator works perfectly now. just having some trouble with the layout. this whole tkinter-thing seems to be more tricky than it should be. how can i make the 4 column of buttons have the same distance and size between them as the other 3 columns? and how can i make the top entry end where the 2nd row entry ends(meaning the top entry will be longer)? why are the 4th row split from the others? hard to fix the problems when u dont even understand why things happen. seems so llogical a lot of it. i change something then something unexpected happens. Look this file over. I built two additional frames. You can control the looks of the progect easier with the additional frames. The calculator DOES NOT WORK. You will have to have to play with it to get the results that you want, which you can do. jim-on-linux http://www.inqvista.com ## class Calc : def __init__ (self) : self.mygui = Tk() self.mygui.title(Calculator) self.MkButtons() def MkButtons(self): mygui = self.mygui dataFra = Frame(mygui) dataFra.grid(row = 0, column = 0) l = Label(dataFra, text=Answer: ) l.grid(row=0, column=0, sticky=EW) self.e = Entry(dataFra) self.e.grid(row=1, column=0, sticky=EW) c = Entry(dataFra) c.grid(row=2, column=0, sticky=EW) x = 1 y = 4 butFra = Frame(mygui) butFra.grid(row=1, column=0) for n in '123+456-789*0()/.': b = Button(butFra, text= n, command = lambda :self.Disp(n), width=2, height=1) b.grid(row=y, column=x, sticky=W) x=x+1 if x==5: x=1 y=y+1 b = Button(butFra, text=^, command=self.Disp, width=2, height=1) b.grid(row=8, column=2, sticky=W) b = Button(butFra, text=C,command=self.Erase, width=2, height=1) b.grid(row=8, column=3, sticky=W) b = Button(butFra, text=c,command=self.Backspace, width=2, height=1) b.grid(row=8, column=4, sticky=W) b = Button(butFra, text==,command=self.Calc, width=18, height=1) b.grid(row=9, column=1, columnspan=4, sticky=EW) def Disp(self, n): print n, '## n cal 68\n' n = ord(n) self.e.insert( 0,str( n)) def Calc(self): expr=e.get() c.delete(0, END) try: c.insert(END, eval(expr)) except: c.insert(END, Not computable) def Erase(self): e.delete(0,END) c.delete(0, END) def Backspace(self): a=len(e.get()) e.delete(a-1,END) #e.delete(INSERT, END) #e.delete(ANCHOR,END) if __name__ == '__main__' : Calc() mainloop() ### ### from __future__ import division import Tkinter from Tkinter import * mygui = Tkinter.Tk() mygui.title(Calculator) l = Label(mygui, text=Answer: ) l.grid(row=2, column=1, columnspan=2, sticky=W) e = Entry(mygui) e.grid(row=1, column=1, columnspan=4, sticky=W) c = Entry(mygui) c.grid(row=2, column=3, columnspan=4, sticky=W) def Disp(nstr): e.insert(INSERT, nstr) def Calc(): expr=e.get() c.delete(0, END) try: c.insert(END, eval(expr)) except: c.insert(END, Not computable) def Erase(): e.delete(0,END) c.delete(0, END) def Backspace(): a=len(e.get()) e.delete(a-1,END) #e.delete(INSERT, END) #e.delete(ANCHOR,END) x = 1 y = 4 for char in '123+456-789*0()/.': b = Button(mygui, text=char, command=lambda n=char:Disp(n), width=2, height=1) b.grid(row=y, column=x, sticky=W) x=x+1 if x==5: x=1 y=y+1 b = Button(mygui, text=^, command=lambda n=**:Disp(n), width=2, height=1) b.grid(row=8, column=2, sticky=W) b = Button(mygui, text=C,command=Erase, width=2, height=1) b.grid(row=8, column=3, sticky=W) b = Button(mygui, text=c,command=Backspace, width=2, height=1) b.grid(row=8, column=4, sticky=W) b = Button(mygui, text==,command=Calc, width=18, height=1) b.grid(row=9, column=1, columnspan=4, sticky=W) mygui.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter, repaint?, keep size?
On Sunday 06 April 2008 13:24, [EMAIL PROTECTED] wrote: so my calculator is almost done for u that have read my previous posts. i have some minor problems i have to fix though. *one is i need to repaint once i have performed a calculation so that the old results are not left on the screen. cant find a method for that. you can use wigit.update(). The update method update will redraw wigits as necessary. If you have the state of the wigit set to DISABLE then set it to ACTIVE before using .update(). *another is now when i write the expression to be evaluated it resizes the window as the text grows. i want the windowsize and all the buttonplacements stay constant, how do i achieve this? I like to make a separate frame for buttons. master = Tk() master.title =('My Project') buttonFrame = Frame(master) buttonFrame.grid(row = 0 column = 1) you could use a dictionary that contains the the text and the command and loop the key to build the buttons. Make x = x+1, y = y+1 for row and column or otherwise as you need. button = Button(buttonframe, text = key, width = 2) button1.grid(row = x, column = y, sticky = NSEW) put other stuff into the master using another frame and grid it in some other column and or row. If you make all buttons the same size inside the frame they will keep their size even if you have more text then the button will hold. There is a lot more but this is the way I would proceed. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter, repaint?, keep size?
On Sunday 06 April 2008 20:12, jim-on-linux wrote: On Sunday 06 April 2008 13:24, [EMAIL PROTECTED] wrote: so my calculator is almost done for u that have read my previous posts. i have some minor problems i have to fix though. *one is i need to repaint once i have performed a calculation so that the old results are not left on the screen. cant find a method for that. you can use wigit.update(). The update method update will redraw wigits as necessary. If you have the state of the wigit set to DISABLE then set it to ACTIVE before using .update(). *another is now when i write the expression to be evaluated it resizes the window as the text grows. i want the windowsize and all the buttonplacements stay constant, how do i achieve this? I like to make a separate frame for buttons. master = Tk() master.title =('My Project') buttonFrame = Frame(master) buttonFrame.grid(row = 0 column = 1) you could use a dictionary that contains the the text and the command and loop the key to build the buttons. Make x = x+1, y = y+1 for row and column or otherwise as you need. If you loop the button you should provide a unique name for each button such as name = name+str(x) button = Button(buttonframe, text = key, width = 2) button1.grid(row = x, column = y, sticky = NSEW) put other stuff into the master using another frame and grid it in some other column and or row. If you make all buttons the same size inside the frame they will keep their size even if you have more text then the button will hold. There is a lot more but this is the way I would proceed. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: python program deleted
thanks for the responses. I put the files in an ftp site and all is well. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
python program deleted
py users, I developed a python program and used py2exe to create the exe. I zip the entire package and email it to my clients. Some clients get the zip file, unzip the package and everything works fine. And some clients get my email with an icon attached which has the correct filename but the size is 8k when it should be about 5 mb. I've renamed the file without the zip ext. and tried other renaming schemes without success. Has anyone had this experience? Any ideas on how to solve this problem. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: escape string to store in a database?
-- Carsten Haesehttp://informixdb.sourceforge.net Thanks for the reply, Carsten, how would this work with UPDATE command? I get this error: cmd = UPDATE items SET content = ? WHERE id=%d % id try this; (update items set contents = (?) where id =(?), [ x, y] ) put your data in a list or (update items set contents = (?) where id =%d , [ x] ) below statement uses 1 refers to the one (?) , 0 supplied, means no list or none in list. jim-on-linux http://www.inqvista.com self.cursor.execute(cmd, content) pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindings supplied. The c rrent statement uses 1, and there are 0 supplied. Sqlite site doesn't give any details on using parameter bindings in UPDATE command, I'm going to look around some more.. -ak -- http://mail.python.org/mailman/listinfo/python-list
Re: Licence confusion: distributing MSVC?71.DLL
If someone has worked their way through this maze before and has an answer, I'd be keen to hear it. This is what someone wrote on 1-21-2007 to this help site about this pain in the a... MSVCR71 stuff. I believe this problem doesn't exist. Licensees of Python are permitted to redistribute mscvr71.dll, as long as they redistribute it in order to support pythonxy.dll. The EULA says # You also agree not to permit further distribution of the # Redistributables by your end users except you may permit further # redistribution of the Redistributables by your distributors to your # end-user customers if your distributors only distribute the # Redistributables in conjunction with, and as part of, the Licensee # Software, you comply with all other terms of this EULA, and your # distributors comply with all restrictions of this EULA that are # applicable to you. In this text, you is the licensee of VS 2003 (i.e. me, redistributing msvcr71.dll as part of Python 2.5), and the Redistributable is msvcr71.dll. The Licensee Software is a software application product developed by you that adds significant and primary functionality to the Redistributables, i.e. python25.dll. IANAL; this is not legal advise. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: class object using widget
On Wednesday 20 February 2008 13:16, you wrote: from Tkinter import * # get widget classes from tkMessageBox import askokcancel # get canned std dialog class Quitter(Frame): # subclass our GUI def __init__(self, parent=None): # constructor method Frame.__init__(self, parent) self.pack() widget = Button(self, text='Quit', command=self.quit) widget.pack(side=LEFT) def quit(self): ans = askokcancel('Verify exit', Really quit?) if ans: Frame.quit(self) if __name__ == '__main__': Quitter().mainloop() In the above program, why the error comes ?? This example works. I only used carriage return and spacebar for formatting. You are using '\xc2' whatever that represents, I'm not sure. But if you carriage return at the end of each line then delete until the next line comes to the cursor then use only space bar and carriage return (Enter) to format you will fix it. Or copy below and paste into your file. jim-on-linux http://www.inqvista.com from Tkinter import * from tkMessageBox import askokcancel class Quitter (Frame): # subclass our GUI def __init__(self, parent=None): # constructor method Frame.__init__(self, parent) self.pack() widget = Button(self, text='Quit', command=self.quit) widget.pack(side=LEFT) def quit(self): ans = askokcancel('Verify exit', Really quit?) if ans: Frame.quit(self) if __name__ == '__main__': Quitter().mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve.open call gives error
On Friday 08 February 2008 12:10, jim-on-linux wrote: On Friday 08 February 2008 03:36, waltbrad wrote: Working through the Mark Lutz book Programming Python 3rd Edition. A couple of modules in the Preview chapter give me errors. Both on a shelve.open call: Pretty simple code, (2nd example): from; jim-on-linux http://[EMAIL PROTECTED] My guess, add this and see if it helps also try import anydbm if not on linux, or import dbhash will work on linux =code begin= import dbhash import shelve from people import Person, Manager bob = Person('Bob Smith', 42, 3, 'sweng') sue = Person('Sue Jones', 45, 4, 'music') tom = Manager('Tom Doe', 50, 5) db = shelve.open('class-shelve') db['bob'] = bob db['sue'] = sue db['tom'] = tom db.close() code end Error message Traceback (most recent call last): File make_db_classes.py, line 9, in module db = shelve.open('class-shelve') File C:\PYTHON25\lib\shelve.py, line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File C:\PYTHON25\lib\shelve.py, line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File C:\PYTHON25\lib\anydbm.py, line 83, in open return mod.open(file, flag, mode) File C:\PYTHON25\lib\dbhash.py, line 16, in open return bsddb.hashopen(file, flag, mode) File C:\PYTHON25\lib\bsddb\__init__.py, line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) bsddb.db.DBError: (5, 'Input/output error') ++End Error message I've looked on the errata pages of his website and used Google to find someone else who ran into this problem. Found someone else who had a similar error but no explanation was given. No other reader of the book seems to have had the problem. I'm using 2.5.1 I thought maybe the file had to exist before it could be opened, so I created one with that name, but no dice. A different but similar set of errors. I also thought maybe there had to be a second argument like 'a', 'r' or 'w'. That doesn't work either. This is the first chapter of the book. It's an overview of the language features. So, this is pretty perplexing. Any help would be appreciated. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve.open call gives error
On Friday 08 February 2008 03:36, waltbrad wrote: Working through the Mark Lutz book Programming Python 3rd Edition. A couple of modules in the Preview chapter give me errors. Both on a shelve.open call: Pretty simple code, (2nd example): from; jim-on-linux http://[EMAIL PROTECTED] My guess, add this and see if it helps =code begin= import dbhash import shelve from people import Person, Manager bob = Person('Bob Smith', 42, 3, 'sweng') sue = Person('Sue Jones', 45, 4, 'music') tom = Manager('Tom Doe', 50, 5) db = shelve.open('class-shelve') db['bob'] = bob db['sue'] = sue db['tom'] = tom db.close() code end Error message Traceback (most recent call last): File make_db_classes.py, line 9, in module db = shelve.open('class-shelve') File C:\PYTHON25\lib\shelve.py, line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File C:\PYTHON25\lib\shelve.py, line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File C:\PYTHON25\lib\anydbm.py, line 83, in open return mod.open(file, flag, mode) File C:\PYTHON25\lib\dbhash.py, line 16, in open return bsddb.hashopen(file, flag, mode) File C:\PYTHON25\lib\bsddb\__init__.py, line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) bsddb.db.DBError: (5, 'Input/output error') ++End Error message I've looked on the errata pages of his website and used Google to find someone else who ran into this problem. Found someone else who had a similar error but no explanation was given. No other reader of the book seems to have had the problem. I'm using 2.5.1 I thought maybe the file had to exist before it could be opened, so I created one with that name, but no dice. A different but similar set of errors. I also thought maybe there had to be a second argument like 'a', 'r' or 'w'. That doesn't work either. This is the first chapter of the book. It's an overview of the language features. So, this is pretty perplexing. Any help would be appreciated. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve.open call gives error
On Friday 08 February 2008 03:36, waltbrad wrote: Working through the Mark Lutz book Programming Python 3rd Edition. A couple of modules in the Preview chapter give me errors. Both on a shelve.open call: Pretty simple code, (2nd example): =code begin= import shelve from people import Person, Manager bob = Person('Bob Smith', 42, 3, 'sweng') sue = Person('Sue Jones', 45, 4, 'music') tom = Manager('Tom Doe', 50, 5) db = shelve.open('class-shelve') db['bob'] = bob db['sue'] = sue db['tom'] = tom db.close() code end This works for me. I converted your numbers to text, I believe shelves requires string keys and values. I had to eliminate the import Person, Manager If you still have problems you have an idea where to look. jim-on-linux http://[EMAIL PROTECTED] # import shelve ##from people import Person, Manager bob = 'Bob Smith', '42, 3', 'sweng' sue = 'Sue Jones', '45, 4', 'music' tom = 'Tom Doe', '50, 5' db = shelve.open('class-shelve') db['bob'] = bob db['sue'] = sue db['tom'] = tom db.close Error message Traceback (most recent call last): File make_db_classes.py, line 9, in module db = shelve.open('class-shelve') File C:\PYTHON25\lib\shelve.py, line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File C:\PYTHON25\lib\shelve.py, line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File C:\PYTHON25\lib\anydbm.py, line 83, in open return mod.open(file, flag, mode) File C:\PYTHON25\lib\dbhash.py, line 16, in open return bsddb.hashopen(file, flag, mode) File C:\PYTHON25\lib\bsddb\__init__.py, line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) bsddb.db.DBError: (5, 'Input/output error') ++End Error message I've looked on the errata pages of his website and used Google to find someone else who ran into this problem. Found someone else who had a similar error but no explanation was given. No other reader of the book seems to have had the problem. I'm using 2.5.1 I thought maybe the file had to exist before it could be opened, so I created one with that name, but no dice. A different but similar set of errors. I also thought maybe there had to be a second argument like 'a', 'r' or 'w'. That doesn't work either. This is the first chapter of the book. It's an overview of the language features. So, this is pretty perplexing. Any help would be appreciated. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter fonts setting
On Tuesday 05 February 2008 15:22, Unnamed One wrote: First question - is it possible to set font to default OS font for window text? It would be preferable, while on my Windows XP system Tkinter sets small Helvetica-style font by default. Secondly, can I set font globally (or specify default font for widgets)? In fact, all I want is to get default OS font unless (rarely) I need to specify another. Thanks Go to: http://www.pythonware.com/library/tkinter/introduction/ Read chapter 6, Widget Styling, there is a section on Fonts which has a sub-section on System Fonts. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Fwd: Re: Problems installing Python on server
Also be careful and setup all the paths that is required for compiling various Python modules etc. On Jan 29, 8:28 am, Yansky [EMAIL PROTECTED] wrote: I asked my hosting company if they would upgrade Python on my server to the latest version. They responded with: Sorry no. We tend to stick with what comes packaged with the unix distribution to ease maintenance issues. There is nothing stopping you from running your own version of python from within your own account. Download the source and compile it and install it into your own space. Adjust the fist line of your python scripts to reflect the location of YOUR python binary: #! /home/youraccount/yourlibs/python and you should be all set. Go to the ReadME file after you unpack python. Open and look for Installing. Read the section, it explains how to install on the entire system and how to install locally. Make altinstall is what you are looking for. jim-on-linux http:\\www.inqvista.com The build instructions for Python are: To start building right away (on UNIX): type ./configure in the current directory and when it finishes, type make. This creates an executable ./python; to install in usr/local, first do su root and then make install. The problem is, I don't have root access to the server so I can't do the make install. I have ubuntu on my computer, but from what I understand I can't compile it on that and upload it because the server runs Red Had and the ./configure would have made it incompatible right? So how can I build Python without root access? Will the make install make my Python the default one? If I want to install some Python modules, will I need to alter their installation as well or will it see my Python version as the right one to install too? Cheers. --- -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Re: Problems installing Python on server
On Thursday 31 January 2008 09:46, jim-on-linux wrote: Also be careful and setup all the paths that is required for compiling various Python modules etc. On Jan 29, 8:28 am, Yansky [EMAIL PROTECTED] wrote: I asked my hosting company if they would upgrade Python on my server to the latest version. They responded with: Sorry no. We tend to stick with what comes packaged with the unix distribution to ease maintenance issues. There is nothing stopping you from running your own version of python from within your own account. Download the source and compile it and install it into your own space. Adjust the fist line of your python scripts to reflect the location of YOUR python binary: #! /home/youraccount/yourlibs/python and you should be all set. Go to the ReadME file after you unpack python. Open and look for Installing. Read the section, it explains how to install on the entire system and how to install locally. Make altinstall is what you are looking for. jim-on-linux http:\\www.inqvista.com The build instructions for Python are: To start building right away (on UNIX): type ./configure in the current directory and when it finishes, type make. This creates an executable ./python; to install in usr/local, first do su root and then make install. The problem is, I don't have root access to the server so I can't do the make install. I have ubuntu on my computer, but from what I understand I can't compile it on that and upload it because the server runs Red Had and the ./configure would have made it incompatible right? So how can I build Python without root access? Will the make install make my Python the default one? If I want to install some Python modules, will I need to alter their installation as well or will it see my Python version as the right one to install too? Cheers. From the Readme file enclose with Python; -- If you have a previous installation of Python that you don't want to replace yet, use make altinstall This installs the same set of files as make install except it doesn't create the hard link to pythonversion named python and it doesn't install the manual page at all. -- I installed python 2.5 using make altinstall by going to /usr/local/lib unpacking, then using make altinstall Folder 2.5 is created. To add modules, as I have added PIL to my system, I go to; /usr/local/lib/python2.5/site-packages where I installed PIL. installing a py module in the site-packages folder is where I would install any package unless otherwise directed. When upgrading you can go to the site directory and see what's in there, and what has to be added to a new upgrade. http:\\www.inqvista.com jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems installing Python on server
On Tuesday 29 January 2008 01:20, Devraj wrote: Also be careful and setup all the paths that is required for compiling various Python modules etc. On Jan 29, 8:28 am, Yansky [EMAIL PROTECTED] wrote: I asked my hosting company if they would upgrade Python on my server to the latest version. They responded with: Sorry no. We tend to stick with what comes packaged with the unix distribution to ease maintenance issues. There is nothing stopping you from running your own version of python from within your own account. Download the source and compile it and install it into your own space. Adjust the fist line of your python scripts to reflect the location of YOUR python binary: #! /home/youraccount/yourlibs/python and you should be all set. Go to the ReadME file after you unpack python. Open and look for Installing. Read the section, it explains how to install on the entire system and how to install locally. Make altinstall is what you are looking for. jim-on-linux http:\\www.inqvista.com The build instructions for Python are: To start building right away (on UNIX): type ./configure in the current directory and when it finishes, type make. This creates an executable ./python; to install in usr/local, first do su root and then make install. The problem is, I don't have root access to the server so I can't do the make install. I have ubuntu on my computer, but from what I understand I can't compile it on that and upload it because the server runs Red Had and the ./configure would have made it incompatible right? So how can I build Python without root access? -- http://mail.python.org/mailman/listinfo/python-list
Re: user friendly datetime features
Why not build your own module? You can use it where and when you need it. jim-on-linux http://www.inqvista.com On Tuesday 08 January 2008 20:19, Daniel Fetchinson wrote: Many times a more user friendly date format is convenient than the pure date and time. For example for a date that is yesterday I would like to see yesterday instead of the date itself. And for a date that was 2 days ago I would like to see 2 days ago but for something that was 4 days ago I would like to see the actual date. This is often seen in web applications, I'm sure you all know what I'm talking about. I'm guessing this feature is needed so often in so many projects that it has been implemented already by several people. Does anyone know of such a stand alone module? -- http://mail.python.org/mailman/listinfo/python-list
Re: It works! Was: Installing Python 3000
On Tuesday 27 November 2007 07:20, André wrote: On Nov 26, 9:59 pm, André [EMAIL PROTECTED] wrote: While I made some progress in trying to install Py3k from source (for the first time), it has failed... Here are the steps I went through (not necessarily in that order - except for those that matter). 1. After installing Leopard, install Xcode tools from the dvd - even if you had done so with a previous version (they need to be updated - trust me :-) 2. Download Python 3.0a1 3. Unpack the archive. 4. Go to /usr/local and make a directory sudo mkdir py3k (This is probably not needed, but that's what I did). 5. From the directory where the Python 3.0a1 was unpacked run ./configure --prefix=/usr/local/py3k 6. run make This last step failed with the following error message: gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include - DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o ./Modules/posixmodule.c: In function 'posix_setpgrp': ./Modules/posixmodule.c:3769: error: too few arguments to function 'setpgrp' make: *** [Modules/posixmodule.o] Error 1 Any suggestions? André Following Martin v Löwis's suggestion, I looked at http://bugs.python.org/issue1358 and added the line #define SETPGRP_HAVE_ARG by hand to pyconfig.h (after it was created by configure). Then 6. run make 7. run make test (one test failed; this step likely unnecessary) 8. sudo make altinstall 9. sudo ln /usr/local/bin/py3k/python3.0 /usr/bin/python3.0 10. type python 11. print(Hello world!) 12. Be happy! André, hoping this report might help some other newbie. Bug fix excluded, After unpacking the compressed version of Python, look for a file named README. Open README and look for Installing. Make install and Make altinstall is explained. I don't like to read instructions but in the long run, it saves time. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Custom Tkinter scrollbar
On Wednesday 14 November 2007 18:22, [EMAIL PROTECTED] wrote: I want to create a custom scrollbar using particular images, which will then be placed on a canvas to control another window on the canvas. Right now I am inheriting from scrollbar, but I do the movement with custom functions. When I create it and put in into the canvas with canvas.create_window a standard scrollbar shows in the correct spot and my custom one is outside of the canvas. All I have right now is something that moves like a scrollbar but has no effect on other objects. Can anyone give me some advice or point me to a guide for this? Is it even possible? Can I create a widget that mimics a scrollbar, or would that be more difficult? I have been unable to find anything online and would appreciate any help. Sounds to me that you want a navigation window for a chosen image. Gimp imaging program has such a window. Check out how gimp works with multiple images. You might want to work with a toolbar that opens a navigation window for each image. For an explanation on how scrolling works check out a book by O'Reilly written by Mark Lutz, Programming Python, look up programming scrollbars. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)
On Monday 01 October 2007 21:04, bramble wrote: What is the backstory to why Python includes Tk bindings, as opposed to some other set of bindings? I've written a few little Tkinter-based apps, and it's nice and simple. I like it well enough. That said though, I keep feeling the gravitational pull toward GTK+. I've been meaning to get the whole glade+gtk+python thing happening with my own projects, as soon as time allows. Is there resistance in the upper Python echelons to GTK because of its LGPL licensing? Reading Alex's Nutshell book, right off the bat he comments that The most popular Python GUI toolkit today is probably wxPython. But then he goes on for 45 pages on Tkinter... Seems like he wanted to write that chapter on wx instead... WxWidgets, the last time I looked at it, seemed awfully like MS Window's MFC. The licensing seemed vague at the time, and it looks like wx contains an extra layer of GUI library, so I didn't spend any real time on it. But, regardless, it seems to get good press among python folk (I think I remember ESR noting how it was his GUI toolkit of choice). PyQt has had that issue (IIRC) about needing to pay for it for commercial apps, so I can see how there might be resistance to it being considered the standard Python GUI toolkit. So, it would seem to me that Tkinter *might* remain in Python proper, but that I probably wouldn't see much effort put into it. Well, the Python standard library docs tell a different story. There's stuff in there about Tix, ScrolledText, turtle, and then the other GUI packages doc page goes on about Python megawidgets (Tk-based) and Tkinter3000 Widget Construction Kit (WCK). Wow. Looks like Tkinter is still having serious support -- even though in that same doc at the bottom notes, PyGTK, PyQt, and wxPython, all have a modern look and feel and far more widgets and better documentation than Tkinter. So, that leaves me wondering, why is Tkinter still getting so much focus in the Python standard library? Maybe a better question is, how has Tk managed to keep beating up the newer, more modern, more featureful, better documented toolkits encroaching on his territory? What's Tk's secret weapon? Tkinter's secret weapon are pgmrs like me that would rather put pressure on the Tk people to improve what already is working. Update and improve Tk, change the look and feel of it, add features. Let me spend my time programming not trying to make existing programs compatible with the unknown. (Some change to who knows what.) On the other hand, questions like yours are exactly what keeps the pressure on the Tkinter people to upgrade. I think they got the message with the recent announcement of some long awaited changes. jim-on-linux http://inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter pack difficulty
On Wednesday 12 September 2007 13:22, Simon Forman wrote: Hi all, I realize this is more of a Tk question than a python one, but since I'm using python and don't know Tcl/Tk I figured I'd ask here first before bugging the Tcl folks. I am having a terrible time trying to get a pack() layout working. I have three frames stacked top to bottom and stretching across the master window from edge to edge. Crude ASCII Art rendition of the frames: | header | | body | | log| I want the header and log frames to have a fixed height (and stick to the top and bottom, respectively, of the master frame) and the body frame to expand to fill the rest of the space, for instance if the window is maximized. Here is a simple script that /almost/ does what I want. I've been tweaking the pack() options for three hours and I just can't seem to get the effect I want. This /can't/ really be this hard can it? If you run the script, be aware that since there are only frame widgets the window will initially be very very tiny. If you expand or maximize the window you'll see a thin black frame at the top, yay, a thin white frame at the bottom, yay, but the middle grey body frame will NOT span the Y axis, boo. It's there, and stretches from side to side, but it refuses to stretch top to bottom. Adding a widget (say, a Text) doesn't help, the light grey non-frame rectangles remain. My investigations seem to indicate that the light grey bars are part of something the Tk docs call a parcel that each slave widget gets packed into. Apparently the header and log frames don't use their entire parcels, but I don't know how to get the parcels themselves to shrinkwrap to the size of the actual Frame widgets. In any event, my head's sore and I'm just about ready to take out some graph paper and use the grid() layout manager instead. But I really want the automatic resizing that the pack() manager will do, rather than the static layout grid() will give me. Any thoughts or advice? Sorry I can't help you with pack, I don't use it anymore. I am able to do everything with grid that I can do with pack. Once I learned to use grid I liked it better than pack. Spend some time to learn grid you may like it. I'm sure others will disagree, but for me it works for everything I need. jim-on-linux http://inqvista.com Thanks in advance, ~Simon # Tkinter script from Tkinter import * t = Tk() header = Frame(t, bg=black, height=10) header.pack(expand=1, fill=X, side=TOP, anchor=N) body = Frame(t, bg=grey) body.pack(expand=1, fill=BOTH, anchor=CENTER) log = Frame(t, bg=white, height=10) log.pack(expand=1, fill=X, side=BOTTOM, anchor=S) t.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
sqlite3 create table col width?
PY help, Using sqlite3 v3.1.3 When I create a table collumn using; newcollum VARCHAR(35), I get a default of 10 spaces. No matter what I set the size to I get 10 spqces, even using varchar(0) defaults to 10 spaces. I would appreciae the help if someone could tell me what I'm missing, I want to varry the column sizes. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 create table col width?
On Saturday 04 August 2007 14:05, Carsten Haese wrote: On Sat, 2007-08-04 at 13:51 -0400, jim-on-linux wrote: PY help, Using sqlite3 v3.1.3 When I create a table collumn using; newcollum VARCHAR(35), I get a default of 10 spaces. No matter what I set the size to I get 10 spqces, even using varchar(0) defaults to 10 spaces. I would appreciae the help if someone could tell me what I'm missing, I want to varry the column sizes. What you're missing is that sqlite columns are type-less. Column type and size are irrelevant: import sqlite3 conn = sqlite3.connect(:memory) cur = conn.cursor() cur.execute(create table t1 (c1 varchar(35))) sqlite3.Cursor object at 0xb7f6dbf0 cur.executemany(insert into t1(c1) values(?), ... [ (X*i*10,) for i in range(10) ] ) cur.execute(select * from t1) sqlite3.Cursor object at 0xb7f6dbf0 for row in cur: print row ... (u'',) (u'XX',) (u'',) (u'XX',) (u'',) (u' XX',) (u' ',) (u' XX',) (u' ',) (u' XX', ) Even though the column was created to be 35 characters wide, it'll happily accept 100-character strings. HTH, -- Carsten Haese http://informixdb.sourceforge.net Right, the data is there. My question is framed wrong. Your answer pointed out the flaw in the question. Since I'm on linux, the database can be opened with Knoda. Once opened the table collumns are always 10 spaces so all the data is not readable as presented. Not quite a python problem. I can Tk a display for the data, just thought I could save time by letting the user open the table and read the data right from the table. Thanks for the help. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Error with Tkinter and tkMessageBox
On Tuesday 31 July 2007 15:24, Fabio Z Tessitore wrote: Il Tue, 31 Jul 2007 19:12:48 +, kyosohma ha scritto: I'm not sure, but I don't think you need the win variable at all. I can get it to work as follows: code from Tkinter import * from tkMessageBox import showinfo def reply(): showinfo(title='ciao', message='hello') Button(text='press me', command=reply).pack(fill=X) mainloop() /code Mike You're right. But the problem I have is always there. Tkinter doesn't work properly and I don't understand why. Thanks! Try This: def reply(): showinfo('ciao','hello') jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve crashing under Win ME
On Saturday 30 June 2007 04:52, [EMAIL PROTECTED] wrote: Hi, I'm not a Win ME fan myself (I'm a Mac user), but I'm here in Thailand developing software for special-needs kids, and the test PC in my home office is a Win ME machine (sigh). So when I ported my Python program today to the PC, it quickly crashed. Everything seems to work except for shelve. Using the latest version of Python (2.5.1), when I do the following in IDLE on the Win ME machine here's the result: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 IDLE 1.2.1 import shelve f=shelve.open(foo) Traceback (most recent call last): File pyshell#1, line 1, in module f=shelve.open(foo) File C:\PYTHON25\lib\shelve.py, line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File C:\PYTHON25\lib\shelve.py, line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File C:\PYTHON25\lib\anydbm.py, line 83, in open return mod.open(file, flag, mode) File C:\PYTHON25\lib\dbhash.py, line 16, in open return bsddb.hashopen(file, flag, mode) File C:\PYTHON25\lib\bsddb\__init__.py, line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) DBError: (5, 'Input/output error') For those who know shelve, this should actually run fine (if the file foo does not exist it should create it). Printing the value of f should show an empty dictionary {}. It does run fine on my iBook (under Python 2.4.4) and on my iBook's Virtual PC running Win XP Python 2.5.0. I do not think this is a Python 2.5.1 problem, because my first attempt to run my program on the Win ME machine was with a version of the program I ported using Py2exe on the VPC under Python 2.5.0, and it crashed the same way when run on the Win ME machine (I subsequently installed Python on the Win ME PC to try to get to the root of the problem.) Help! How do I get Win ME (or at least the misbehaving Win ME machine in my office) to run shelve? (or more specifically run bsddb's hashopen?) Or should I trash shelve entirely and rewrite all my code to use a simpler, homemade database scheme? Thanks for any advice! Warmly, Joel [EMAIL PROTECTED] what version of py2exe are you using? I had a similar problem with an old version of py2exe but it it is fixed now. If my memory is correct I had to import dbhash into my setup for py2exe back then to fix it.. Your code for shelve is correct, the problem is someplace else. jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve crashing under Win ME
On Saturday 30 June 2007 10:07, jim-on-linux wrote: On Saturday 30 June 2007 04:52, [EMAIL PROTECTED] wrote: Hi, I'm not a Win ME fan myself (I'm a Mac user), but I'm here in Thailand developing software for special-needs kids, and the test PC in my home office is a Win ME machine (sigh). So when I ported my Python program today to the PC, it quickly crashed. Everything seems to work except for shelve. Using the latest version of Python (2.5.1), when I do the following in IDLE on the Win ME machine here's the result: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 IDLE 1.2.1 import shelve f=shelve.open(foo) Traceback (most recent call last): File pyshell#1, line 1, in module f=shelve.open(foo) File C:\PYTHON25\lib\shelve.py, line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File C:\PYTHON25\lib\shelve.py, line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File C:\PYTHON25\lib\anydbm.py, line 83, in open return mod.open(file, flag, mode) File C:\PYTHON25\lib\dbhash.py, line 16, in open return bsddb.hashopen(file, flag, mode) File C:\PYTHON25\lib\bsddb\__init__.py, line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) DBError: (5, 'Input/output error') For those who know shelve, this should actually run fine (if the file foo does not exist it should create it). Printing the value of f should show an empty dictionary {}. It does run fine on my iBook (under Python 2.4.4) and on my iBook's Virtual PC running Win XP Python 2.5.0. I do not think this is a Python 2.5.1 problem, because my first attempt to run my program on the Win ME machine was with a version of the program I ported using Py2exe on the VPC under Python 2.5.0, and it crashed the same way when run on the Win ME machine (I subsequently installed Python on the Win ME PC to try to get to the root of the problem.) Help! How do I get Win ME (or at least the misbehaving Win ME machine in my office) to run shelve? (or more specifically run bsddb's hashopen?) Or should I trash shelve entirely and rewrite all my code to use a simpler, homemade database scheme? Thanks for any advice! Warmly, Joel [EMAIL PROTECTED] what version of py2exe are you using? I had a similar problem with an old version of py2exe but it it is fixed now. If my memory is correct I had to import dbhash into my setup for py2exe back then to fix it.. Your code for shelve is correct, the problem is someplace else. jim-on-linux http:\\www.inqvista.com Correction: I had to import dbhash into my program to make things work. jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter - resize tkMessageBox
On Monday 04 June 2007 16:29, [EMAIL PROTECTED] wrote: Hi, Is there a way to resize the width of the tkMessageBox.askyesno dialog box, so that the text does not wrap to the next line. Thanks Rahul I don't know of any. It's a little more work but your better off using Toplevel and/or frame, you have more control over the window and its appearance. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Circular imports
On Tuesday 29 May 2007 00:08, Carsten Haese wrote: On Mon, 28 May 2007 23:46:00 -0400, Ron Provost wrote [...] python is not happy about my circular imports [...] A circular import is not a problem in itself. I'm guessing you're running into a situation like this: Module A imports module B and then defines an important class. Module B imports A (which does nothing because A is already partially imported) and then defines a class that depends on the class that is defined in module A. That causes a NameError. The root of the problem is that all statements are executed in the order in which they appear, and B is imported before A had a chance to define the class that B depends on. Note that import statements don't have to be at the top of the file. I agree, waite until python complains. You might try to remove all of the import statements then add then as they are requested by the program by a traceback error. jim-on-linux Try moving each import statement to the latest possible point in the code, i.e. right before the first occurence of whatever names you're importing from the respective modules. That way, each module gets to define as much as it possibly can before it gets side-tracked by importing other modules. If my guess doesn't help, you're going to have to post at least the exception/traceback you're getting, and you're probably going to have to post some code, too. Good luck, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: python unix install, sqlite3
On Tuesday 29 May 2007 08:52, Simon wrote: I installed the source code on unix for python 2.5.1. The install went mainly okay, except for some failures regarding: _ssl, _hashlib, _curses, _curses_panel. No errors regarding sqlite3. However, when I start python and do an import sqlite3 I get: /ptmp/bin/ python Python 2.5.1 (r251:54863, May 29 2007, 05:19:30) [GCC 3.3.2] on sunos5 Type help, copyright, credits or license for more information. import sqlite3 I'm using python 2.5 on linux and it works fine Try; import sqlite3 in place of from sqlite3 import * jim-on-linux http://www.inqvista.com Traceback (most recent call last): File stdin, line 1, in module File /ptmp/Python-2.5.1/lib/python2.5/sqlite3/__ini t__.py, line 24, in module from dbapi2 import * File /ptmp/Python-2.5.1/lib/python2.5/sqlite3/dbapi 2.py, line 27, in module from _sqlite3 import * ImportError: No module named _sqlite3 -- http://mail.python.org/mailman/listinfo/python-list
Re: What happened to [EMAIL PROTECTED]
On Friday 04 May 2007 22:19, Carsten Haese wrote: Hiya, I just tried sending an email to [EMAIL PROTECTED] to request a website change, and the email bounced back with this excerpt from the delivery failure report: Reporting-MTA: dns; bag.python.org [...] Final-Recipient: rfc822; [EMAIL PROTECTED] Original-Recipient: rfc822; [EMAIL PROTECTED] Action: failed Status: 5.0.0 Diagnostic-Code: X-Postfix; unknown user: webmaster Who should I contact to request the website change? Thanks, Carsten. I'm not sure but you can try; [EMAIL PROTECTED] or http://mail.python.org/ jim-on-lnux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: PY shutil on win xp home version
Thanks Tim for resopnding, I appreciate the help. I convinced the client to install Linux on 4 machines rather than upgrade from xp home to XP Pro, and more machines to come if the like it. jim-on-linux On Friday 20 April 2007 03:22, you wrote: jim-on-linux wrote: On Wednesday 18 April 2007 17:02, Tim Golden wrote: jim-on-linux wrote: python help, A client is using win xp home. my program contains; shutil.copyfile(n, 'prn') This runs fine on win xp pro but they are getting the following traceback. File LOP_PRT_10.pyc, line 170, in __init__ File LOP_PRT_10.pyc, line 188, in Fprint1 File shutil.pyc, line 47, in copyfile IOError: [Errno 2] No such file or directory: 'prn' Since this runs ok on win xp pro, does this have something to do with the home version of xp. I'm thinking of changeing 'prn' to 'lpt1' and trying again but I don't want to use the client as a testor. Or is there some other explaination for the problem. Not that this is your question, but if you're trying to print under Windows have you looked at: http://tgolden.sc.sabren.com/python/win32_ho w_d o_i/print.html for alternatives? TJG Thanks for the response, I got the following to work on windows. win32api.ShellExecute ( 0, 'print', filename, None, ., 0 ) However it prints the name of the file at the top and adds a page number on the bottom. Is there some way of eliminating the filename and page number. Unfortunately, this approach is quick-and-dirty and you're at the mercy of whatever the print verb does to filename on your box. (Although you can configure that if you try hard enough). I'm afraid if you want control, you'll have to go the PDF route or to automate Word / OpenOffice etc. TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Expanding tkinter widgets to fill the window
On Friday 20 April 2007 13:56, Anton Vredegoor wrote: KDawg44 wrote: I am writing a GUI front end in Python using Tkinter. I have developed the GUI in a grid and specified the size of the window. The widgets are centered into the middle of the window. I would like them to fill the window. I tried using the sticky=E+W+N+S option on the widgets themselves and the window itself. How can I get this? If at all possible post a short, self-contained, correct, example demonstrating your question. http://homepage1.nifty.com/algafield/sscce.html A. try; sticky = NSEW without plus signs headFrame = Frame(win01, bg = 'light grey', bd=10) headFrame.grid(row = 0, column=0, sticky = NSEW) jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: PY shutil on win xp home version
On Wednesday 18 April 2007 17:02, Tim Golden wrote: jim-on-linux wrote: python help, A client is using win xp home. my program contains; shutil.copyfile(n, 'prn') This runs fine on win xp pro but they are getting the following traceback. File LOP_PRT_10.pyc, line 170, in __init__ File LOP_PRT_10.pyc, line 188, in Fprint1 File shutil.pyc, line 47, in copyfile IOError: [Errno 2] No such file or directory: 'prn' Since this runs ok on win xp pro, does this have something to do with the home version of xp. I'm thinking of changeing 'prn' to 'lpt1' and trying again but I don't want to use the client as a testor. Or is there some other explaination for the problem. Not that this is your question, but if you're trying to print under Windows have you looked at: http://tgolden.sc.sabren.com/python/win32_how_d o_i/print.html for alternatives? TJG Thanks for the response, I got the following to work on windows. win32api.ShellExecute ( 0, 'print', filename, None, ., 0 ) However it prints the name of the file at the top and adds a page number on the bottom. Is there some way of eliminating the filename and page number. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
PY shutil on win xp home version
python help, A client is using win xp home. my program contains; shutil.copyfile(n, 'prn') This runs fine on win xp pro but they are getting the following traceback. File LOP_PRT_10.pyc, line 170, in __init__ File LOP_PRT_10.pyc, line 188, in Fprint1 File shutil.pyc, line 47, in copyfile IOError: [Errno 2] No such file or directory: 'prn' Since this runs ok on win xp pro, does this have something to do with the home version of xp. I'm thinking of changeing 'prn' to 'lpt1' and trying again but I don't want to use the client as a testor. Or is there some other explaination for the problem. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the best way to upgrade python?
On Thursday 22 March 2007 15:18, Facundo Batista wrote: [EMAIL PROTECTED] wrote: i am using red hat enterprise 4. It has python 2.3 installed. What is the best way to upgrade to python 2.4? I think one way is to compile python 2.4 from the source, but I can't remove the old one since when i do 'rpm -e python', i get error like 'failed dependencies'. Install Py2.4 and actually start using it, are two different animals. For example, I have installed Py2.4 and Py2.5 in my laptop. They coexist, and there's no problem about this. Telling all your installed applications to use the newer, it's not so easy, mainly because you don't have the power to test and change every installed application. So let them be. Just install the new version, and use it. Regards, -- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ I recently installed py 2.5 and I used the local user option. Now I build programs on 2.5 but I left the system with the original 2.4? since it worked just fine. Look in the instructions on how to build for local users and you 'll save yourself from encountering the unexpected. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: the second of nested buttons using textvariable remains void!
On Wednesday 21 March 2007 20:11, Samkos wrote: Hi there, I am fighting with a problem I intended to believe trivial that I could not solve yet! I am trying to have a button with a variable text, that pops up another button with a variable text when pressed. I did that with the following program in Python, but the second button remains always void!!! is it related to the textvariable parameters? If any of you had a clue, please don't hesitate! in advance, many thanks Samuel #--- program 2 buttons.py -- from Tkinter import * def go(event): root = Tk() s1=StringVar() s1.set(s1) label1 = Label(root, textvariable=s1) label1.pack(side=LEFT) root.mainloop() root = Tk() s0=StringVar() s0.set(s0) label0 = Label(root, textvariable=s0) label0.pack(side=LEFT) root.bind(Return,go) root.mainloop() try this; def go(): root = Tk() root.config(bg= 'yellow') s1=StringVar() blabel1 = Button(root, textvariable=s1, width = 10, height = 2, command = next) blabel1.pack() root.bind(Return, vbind) s1.set('click_s1') def vbind(event): next() def next(): second = Toplevel() s0=StringVar() s0.set(click_s0) blabel0 = Button(second, textvariable=s0, command = second.destroy, width = 10, height = 2) blabel0.pack() if __name__ == '__main__' : go() mainloop() jim-on-linux http://inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: mysterious unicode
On Tuesday 20 March 2007 18:35, Gerry wrote: I'm using pyExcelerator and xlrd to read and write data from and to two spreadsheets. I created the read spreadsheet by importing a text file - and I had no unicode aspirations. When I read a cell, it appears to be unicode u'Q1, say. I can try cleaning it, like this: try: s.encode(ascii, replace) except AttributeError: pass which seems to work. Here's the mysterious part (aside from why anything was unicode in the first place): print debug, c=, col, r=, row, v=, value, qno=, qno tuple = (qno, family) try: data[tuple].append(value) except: data[tuple] = [value] print debug, !!!, col, row, qno, family, tuple, value, data[tuple] which produces: c= 1 r= 3 v= 4 qno= Q1 !!! 1 3 Q1 O (u'Q1', 'O') 4 [1, u' ', 4] where qno seems to be a vanilla Q1, but a tuple using qno is (u'Q1', ...). Can somebody help me out? I have been getting the same thing using SQLite3 when extracting data fron an SQLite3 database. I take the database info which is in a list and do name = str.record[0] rather than name = record[0] So far, I havn't had any problems. For some reason the unicode u is removed. I havn't wanted to spend the time to figure out why. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: mysterious unicode
On Tuesday 20 March 2007 21:17, Carsten Haese wrote: On Tue, 2007-03-20 at 20:26 -0400, jim-on-linux wrote: I have been getting the same thing using SQLite3 when extracting data fron an SQLite3 database. Many APIs that exchange data choose to exchange text in Unicode because that eliminates encoding uncertainty. Whether an API uses Unicode would probably be noted somewhere in its documentation. I take the database info which is in a list and do name = str.record[0] You probably mean str(record[0]) . Yes, rather than name = record[0] So far, I havn't had any problems. For some reason the unicode u is removed. I havn't wanted to spend the time to figure out why. As a software engineer, I'd get worried if I didn't know why the code I wrote works. Maybe that's just me. I don't disagree, but sometime depending on the situation, time to investigate is a luxury. However, ( If you don't have the time to do it right the first time when will you have the time to fix it.) Unicode is not rocket science. I suggest you read http://www.amk.ca/python/howto/unicode to demystify what Unicode objects are and do. With str(), you're asking the Unicode object for its byte string interpretation, which causes the Unicode object to give you its encoding in the system default encoding. The default encoding is normally ascii. That can be tweaked for your particular Python installation, but if you need an encoding other than ascii it's recommended that you explicitly encode and decode from and to Unicode, lest you risk writing non-portable code. Using str() coercion of Unicode objects will work well enough until you run into a string that contains characters that can't be represented in the default encoding. Right, even though None or null are not strings they are common enough to cause a problem. Try to run a loop through a list with None or null in it. Example, x = str(list[2]) when list[2] = null or None, problems. Easy to fix but more work. I'll check the web site out. Thanks for the update, Jim-on-linux Once that happens, you're better off explicitly encoding the Unicode object into a well-defined encoding on input, or, even better, just work with Unicode objects internally and only encode to byte strings when absolutely necessary, such as when outputting to a file or to the console. Hope this helps, Carsten. -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLite3, data not found
On Friday 16 March 2007 18:23, Jerry Hill wrote: On 3/16/07, jim-on-linux [EMAIL PROTECTED] wrote: Below, the first select produces results but, after closing then re-opening the database the select produces an empty list. Anyone know the reason ?? When you first open a connection, you implicitly begin a transaction. You need to call con.commit() before you close the connection, or your transaction will be rolled back when you close() it. If don't want to bother with transaction handling, you can turn it off when you open the connection, like this: con = sqlite3.connect('myData', isolation_level=None) See the Python Database API 2.0 PEP for more details about the behavior required of DB-API 2.0 compliant interfaces: http://www.python.org/dev/peps/pep-0249/ -- Jerry Thanks, this saves a lot of con.commit action. And the website is valuable. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLite3, data not found
On Saturday 17 March 2007 13:51, John Nagle wrote: jim-on-linux wrote: On Friday 16 March 2007 18:23, Jerry Hill wrote: On 3/16/07, jim-on-linux [EMAIL PROTECTED] wrote: Below, the first select produces results but, after closing then re-opening the database the select produces an empty list. Anyone know the reason ?? When you first open a connection, you implicitly begin a transaction. You need to call con.commit() before you close the connection, or your transaction will be rolled back when you close() it. If don't want to bother with transaction handling, you can turn it off when you open the connection, like this: con = sqlite3.connect('myData', isolation_level=None) See the Python Database API 2.0 PEP for more details about the behavior required of DB-API 2.0 compliant interfaces: http://www.python.org/dev/peps/pep-0249/ -- Jerry Thanks, this saves a lot of con.commit action. And the website is valuable. jim-on-linux Don't turn off atomic transactions, use them. Otherwise, two copies of your program running at the same time will probably not do what you want. Just call commit at the end of each transaction. John Nagle Thanks I appreciate the help. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
SQLite3, data not found
Python help, I just started working with SQLite3 and ran into this problem. Below, the first select produces results but, after closing then re-opening the database the select produces an empty list. Anyone know the reason ?? The table seems to be empty. import sqlite3 con = sqlite3.connect('myData') cursor = con.cursor() cursor.execute (create table data (recordNo varchar, caseNo varchar)); record = ['A', 'B'] cursor.execute(insert into data values (?,?), record ) ; cursor.execute(select * from data ); print cursor.fetchall(); con.close() con = sqlite3.connect('myData') cursor = con.cursor() cursor.execute(select * from data); print cursor.fetchall(); jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLite3, data not found
from John Clark use con.commit() Thanks John, this works jim-on-linux On Friday 16 March 2007 17:55, jim-on-linux wrote: Python help, I just started working with SQLite3 and ran into this problem. Below, the first select produces results but, after closing then re-opening the database the select produces an empty list. Anyone know the reason ?? The table seems to be empty. import sqlite3 con = sqlite3.connect('myData') cursor = con.cursor() cursor.execute (create table data (recordNo varchar, caseNo varchar)); record = ['A', 'B'] cursor.execute(insert into data values (?,?), record ) ; cursor.execute(select * from data ); print cursor.fetchall(); con.close() con = sqlite3.connect('myData') cursor = con.cursor() cursor.execute(select * from data); print cursor.fetchall(); jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: attaching Tkinter Listbox to python list object
On Monday 12 March 2007 20:34, Steve Potter wrote: I am trying to find some method of attaching a Listbox object to a list object so as the contents of the list are changed the contents of the Listbox will be updated to match. I have found a few references to something like this in this old post http://groups.google.com/group/comp.lang.python /browse_thread/thread/3a6fe7534c812f55/43f201ab5 3cfdbf7 as well as here http://effbot.org/zone/wck-4.htm . It just seems that there should be some way of achieving this. The only this I can think of is create a subclass of list that deletes and then refills the Listbox every time that the list changes, but this seems very in efficient. Any ideas? Steve Look into the StringVar(), class for Tkinter. var = stringVar() sorry I can't help more, but I think this is what you are looking for. jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Signed zeros: is this a bug?
On Sunday 11 March 2007 10:31, Mark Dickinson wrote: I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, in case it's relevant.) x, y = 0.0, -0.0 x, y (0.0, 0.0) x, y = -0.0, 0.0 x, y (-0.0, -0.0) I would have expected y to be -0.0 in the first case, and 0.0 in the second. Should the above be considered a bug, or is Python not expected to honour signs of zeros? I'm working in a situation involving complex arithmetic where branch cuts, and hence signed zeros, are important, and it would be handy if the above code could be relied upon to do the right thing. Mark This works for some reason instead of x,y = -0.0, 0.0 clumpy but the results are right. x = -0.0 y= 0.0 x,y (-0.0, 0.0) jim-on-linux http:\\inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Signed zeros: is this a bug?
# Interesting. So on Windows there's probably no hope of what I want to do working. But on a platform where the C library does the right thing with signed zeros, this behaviour is still a little surprising. I guess what's happening is that there's some optimization that avoids creating two separate float objects for a float literal that appears twice, and that optimization doesn't see the difference between 0. and -0. x, y = 0., -0. id(x) == id(y) True jim-on-linux's solution works in the interpreter, but not in a script, presumably because we've got file-wide optimization rather than line-by-line optimization. #test.py x = -0.0 y = 0.0 print x, y #end test.py import test -0.0 -0.0 Mark This is the only way I could make this work in a script. from decimal import Decimal x = Decimal( -0.0) y= Decimal(0.0) print x,y x = Decimal( 0.0) y= Decimal(-0.0) print x,y jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
SQLite3 trapping OperationalError
pyhelp, I set up a table in SQLite3. While running other modules I want to know if a table exists. SQL has a command List Tables but I don't think SQLlite3 has this command. I've tried cursor.execute(select * from debtor where key is not null ) The table debtor does not exist so I get OperationalError which I want to trap with try/except or some other way. However python 2.5, except OperationalError: responds with OperationalError is not defined. Ideas on how to determine if a table exists would be welcome. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLite3 trapping OperationalError
On Friday 09 March 2007 13:10, Jerry Hill wrote: On 3/9/07, jim-on-linux [EMAIL PROTECTED] wrote: However python 2.5, except OperationalError: responds with OperationalError is not defined. I believe that needs to be spelled except sqlite3.OperationalError: do_something() -- Jerry Thanks, except sqlite3.OperationalError: works for me. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter text editor
On Friday 09 March 2007 12:04, Gigs_ wrote: Gigs_ wrote: I'm writing text editor. How to enable/disable (cut, copy etc.) when text is selected/not selected Btw it is cut copy ... in edit menu state = 'diabled' ## no change allowed ## to Text Wiget state = 'normal' ## default for Text Wiget jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: writing dictionary to file
On Thursday 08 March 2007 14:40, kavitha thankaian wrote: Hi Simon, iam till here: dorc=some['DorC'] amount=some['amount'] f=open(logfile.txt, w) if dorc =='C': a = -(amount) if dorc == 'D': b = amount sum=a + b if sum == 0: f.writelines(name:) f.writelines(%s %some['name']) f.writelines(credit:) f.writelines(%s % amount) but i see an empty file opened,,, kavitha Simon Brunning [EMAIL PROTECTED] wrote: On 3/8/07, kavitha thankaian wrote: can anyone help me??? I'm sure we can. How far have you got so far? try f=open(logfile.txt, w) f.write('name') f.write('\n') f.write(('credit(') f:close() jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: askstring Window to the top under Windows
On Wednesday 07 March 2007 05:05, iwl wrote: On 7 Mrz., 02:49, jim-on-linux [EMAIL PROTECTED] wrote: On Tuesday 06 March 2007 08:13, iwl wrote: Hi, I tryed askstring to input some text in my script, but some ugly empty Window appears with the Input-Window behind and all together behind my Console showing my script. So all have to brought to the top first by the user - very unconfortable By default tk will open a root window. Is this default changeable befor askstring? Here is an example of a simple button that will open a tkSimpleDialog box == from Tkinter import * import tkSimpleDialog from tkSimpleDialog import askfloat root = Tk() ## this is the default window vlab = Button( root, text= 'Click here to Open Dialog', width = 20, height = 2, bg = 'yellow', command =(lambda: askfloat( 'Entery', 'Enter credit card number') ) ) vlab.grid() mainloop() jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: askstring Window to the top under Windows
On Wednesday 07 March 2007 05:02, Ingo Wolf wrote: Original-Nachricht Datum: Tue, 06 Mar 2007 20:49:42 -0500 Von: jim-on-linux [EMAIL PROTECTED] An: python-list@python.org CC: iwl [EMAIL PROTECTED] Betreff: Re: askstring Window to the top under Windows By default tk will open a root window. so you will have to create something to put into the root window. I suggest a button to open the tkSimpleDialog box. go to; http://www.pythonware.com/library/tkinter/int roduction/ I've allready had a short look trough this to find an idea how to change this behavior (which should be done by the askstring makers) but haven't up to now. I think what I do is what askstring was made for keeping me away from tk internals only wanting a little string input. Because I have embedded python In my C-App I make my own window now In C and extend python by it so having more control about things happen. Check out how to use Entry Wiget for data entry. from Tkinter import * root = Tk() ## this is the default window vlab = Label(root, width = 20, text = 'Enter data here') vlab.grid( row=0, column =0) ventry= Entry(root, width = 30) ventry.grid(row = 0, column = 1) mainloop() jim-on-linux http:\\www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: askstring Window to the top under Windows
On Tuesday 06 March 2007 08:13, iwl wrote: Hi, I tryed askstring to input some text in my script, but some ugly empty Window appears with the Input-Window behind and all together behind my Console showing my script. So all have to brought to the top first by the user - very unconfortable By default tk will open a root window. so you will have to create something to put into the root window. I suggest a button to open the tkSimpleDialog box. go to; http://www.pythonware.com/library/tkinter/introduction/ jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: pop method question
On Saturday 03 March 2007 15:56, Nicholas Parsons wrote: On Mar 3, 2007, at 3:49 PM, Paul Rubin wrote: Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the literature, pop is supposed to be an operation defined for a stack data structure. A stack is defined to be an ordered list data structure. Dictionaries in Python have no order but are sequences. Now, does anyone know why the python core has this pop method implemented for a dictionary type? aDict.pop(theKey) 'produce the value' pop removes the key:value and produces the value as results jim-on-linux http:\\www.inqvista.com Try typing: help({}.pop) -- http://mail.python.org/mailman/listinfo/pytho n-list Thanks, that gives a more details explanation of what the behavior is but doesn't answer my question above :( -- http://mail.python.org/mailman/listinfo/python-list
window opens with os.system()
python help, I'm testing on xpPro I have a simple module that sends text files to a printer. Then, it moves the file to the 'Fprtd' directory. The module contains the following code; # for n in PrtList: os.system('type '+n+ ' prn' os.system('move '+n+ ' Fprtd') # os.system opens and closes a window for each file it sends to the printer and again for each time it moves a file to the Fprtd directory. If there were only a few files, this wouldn't be so bad. But, when the files number 300 to 400 it becomes objectionable. Is there any way to supress the flashing window. xp no longer allows the 'ctty' command. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: window opens with os.system()
On Sunday 18 February 2007 17:27, Gabriel Genellina wrote: En Sun, 18 Feb 2007 18:09:23 -0300, jim-on-linux [EMAIL PROTECTED] escribió: I have a simple module that sends text files to a printer. Then, it moves the file to the 'Fprtd' directory. The module contains the following code; # for n in PrtList: os.system('type '+n+ ' prn' os.system('move '+n+ ' Fprtd') Thanks Geneilina, It works fine. shutil.copyfile(xxx,prn) jim-on-linux # os.system opens and closes a window for each file it sends to the printer and again for each time it moves a file to the Fprtd directory. If there were only a few files, this wouldn't be so bad. But, when the files number 300 to 400 it becomes objectionable. Just code the above in Python itself. type xxx prn == copy xxx prn == shutil.copyfile(xxx,prn) move xxx Fprtd == shutil.move(xxx, Fprtd) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: can't find a way to display and print pdf through python.
I'm using Suse Linux which has five program that will open a pdf file from a shell command line. Acrobat Reader is one of the five. A right button click on the file should give a list of programs that will open a PDF file. Im using a KDE desktop Open a shell, add the path to the directory where the PDF file lives, and on the command line type; xpdf myfile.pdf ## may also work on a Gnome ## Desktop or any of these for the KDE desktop; kpdf myfile.pdf Kghostview myfile.pdf konqueror myfile.pdf ## my browser + myfile. Acrobat Reader is also listed on my system. It open files as adobe reader using the mouse to open a pdf file but not from the command line with an arg, and I haven't spent the time to figgure out why. You will have to import os and some combination of any of the exec.. args, or the popen, spawn, or system modules. os.execvep() ## or others like execl, execle os.spawnv(), os.spawnve(), os.popen() hope this give some direction. jim-on-linux On Tuesday 13 February 2007 03:44, Jussi Salmela wrote: Grant Edwards kirjoitti: On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote: On 2007-02-12, Larry Bates [EMAIL PROTECTED] wrote: I at least need the code for useing some library for connecting to acrobat reader and giving the print command on windows and some thing similar on ubuntu linux. Just let the registered .PDF viewer do it for you. os.start('myfile.pdf') Eh? I don't see os.start() it either 2.5 or 2.44 documentation, and it's sure not there in 2.4.3: My bad. os.system() That doesn't work either: $ ls -l user.pdf -rw--- 1 grante users 35640 2005-11-21 14:33 user.pdf $ python Python 2.4.3 (#1, Dec 10 2006, 22:09:09) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type help, copyright, credits or license for more information. import os os.system('user.pdf') sh: user.pdf: command not found 32512 Works fine on my system. You linux guys just have it hard. The op said windows. The posting to which you replied specified Linux. I can't answer for ubuntu linux but maybe you can help there? I don't see how. Pdf files just aren't executable. On Windows, this (where fileName is xyz.PDF, for example): webbrowser.open(r'file://' + fileName) starts Acrobat Reader with the document read in. I have no idea why, because Acrobat Reader sure ain't my browser;) Maybe someone could try this out on Linux. Cheers, Jussi -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: how; newbie
On Tuesday 13 February 2007 18:02, Gigs_ wrote: can someone explain me this code? from Tkinter import * root = Tk() def callback(event): print clicked at, event.x, event.y frame = Frame(root, width=100, height=100) frame.bind(Button-1, callback) frame.pack() root.mainloop() if you live on longititude 32, wrere is that? If you live on latitude 40 and longitiude 32 I can find that location. Your mouse is pointing to x, and y, which is simply a location on the screen. well, my problem is at frame.bind(,Button-1, callback) callback function prints event.x and event.y. How the callback function get this two number when it has only one argument (event) Why its not: def callback(x, y): print x, y Im new to gui programming Sorry for bad eng! Thanks for replay! -- http://mail.python.org/mailman/listinfo/python-list
Re: can't find a way to display and print pdf through python.
For those who care, the file below should run on a unix/ linux style system. And xpdf, amoung others, will run a pdf file. import os def Printpdf(): os.system( 'xpdf form.pdf' ) if __name__ == '__main__' : Printpdf() jim-on-linux On Tue, 13 Feb 2007 08:44:18 GMT, Jussi Salmela [EMAIL PROTECTED] declaimed the following in comp.lang.python: On Windows, this (where fileName is xyz.PDF, for example): webbrowser.open(r'file://' + fileName) starts Acrobat Reader with the document read in. I have no idea why, because Acrobat Reader sure ain't my browser;) Most likely Adobe installed the Acrobat plug-in for the browser... The browser identifies the file as PDF and passes it to the plug-in for rendering. -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED] HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff:[EMAIL PROTECTED]) HTTP://www.bestiaria.com/ -- http://mail.python.org/mailman/listinfo/python-list
download win32file
Where can I download win32file / win32ui? The links below are broken. Mark Hammond should be made aware of this. URL below has two links that send you no place http://mail.python.org/pipermail/python-list/2002-October/167638.html Links: http://starship.python.net/crew/mhammond/win32/Downloads.html http://starship.python.net/crew/mhammond/downloads/win32all-148.exe Produce; The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: download win32file
On Monday 15 January 2007 10:37, hg wrote: jim-on-linux wrote: Where can I download win32file / win32ui? The links below are broken. Mark Hammond should be made aware of this. URL below has two links that send you no place http://mail.python.org/pipermail/python-list/ 2002-October/167638.html Links: http://starship.python.net/crew/mhammond/win3 2/Downloads.html http://starship.python.net/crew/mhammond/down loads/win32all-148.exe Produce; The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. jim-on-linux Do you mean PyWin32 ? ?? Do I have to download pywin32 to get win32ui, or win32file, or win32api http://sourceforge.net/projects/pywin32/ -- http://mail.python.org/mailman/listinfo/python-list
Re: download win32file
On Monday 15 January 2007 18:02, Bill Tydeman wrote: ?? Do I have to download pywin32 to get win32ui, or win32file, or win32api Yes Got it. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: where is python on linux?
on linux type: whereis python You should get a list of directories where all of python lives. jim-on-linux http:\\www.inqvista.com On Sunday 07 January 2007 04:05, Frank Potter wrote: I installed fedora core 6 and it has python installed. But the question is, where is the executable python file? I can't find it so I come here for help. I want to config pydev for eclipse and I need to know where the ececutable python file is. Thank you! -- http://mail.python.org/mailman/listinfo/python-list
Re: Easiest way to print from XP/DOS.
Thanks, The client is in a one printer office. If the output file is opened with note and then sent to the printer everything is fine but it defeats the purpose of the utility. Also tried lpt1 but the same results. I'm trying to find out if this was some change in xp from previous versions, or is there something abnormal going on. I'm trying to avoid setting up an xp machine for one client. jim-on-linux On Saturday 30 December 2006 03:05, Tim Roberts wrote: jim-on-linux [EMAIL PROTECTED] wrote: Did you run from a file or type in from keyboard? When the client runs the utility program the output file is built but nothing prints and no messages appear. When I typed from keyboard on an xp pro at c:\, I got the message. Is it possible that virus detector or some self.defense software is interacting? It is quite possible that they simply do not have a printer hooked up to their computer's parallel port. If all of your printers are from network shares, then the special file prn will not go anywhere. Typing to prn is a dreadful way to do printing on Windows. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Easiest way to print from XP/DOS.
Thanks, However, using note to print is a problem. First, because note adds a header( file name etc.) to the printed output that is not acceptable. Next, the number of files is 200 to 300 per day. The idea of the utility is to eliminate the operator. But, if you have a virus detector that stops the operation then I think I may have to install the program as opposed to unzipping and running the exe file. On Saturday 30 December 2006 01:33, Tom Plunker wrote: jim-on-linux wrote: When the client runs the utility program the output file is built but nothing prints and no messages appear. If the file has a '.txt' extension, you could try os.system'ing start filename, which'll make the file pop open with notepad (or whatever happens to be associated with TXT files), from which the user would need to press Ctrl-P to make it print. Is it possible that virus detector or some self.defense software is interacting? Quite. I run firewall software on my PC that alerts me when a program is trying to launch another program. The message that it gives is not entirely unlike the one you gave me. To diagnose further, you could have the victim send you a screenshot to see what's really going on. With Outlook, it's as easy as hitting the Print Screen button (when the message is visible) and pasting the clipboard into an email. Alternatively, they paste into MS Paint, save the bitmap somewhere, and mail that to you. Good luck, -tom! -- -- http://mail.python.org/mailman/listinfo/python-list
Easiest way to print from XP/DOS.
This is the situation I'm in. I've built a single file utility using py2exe. I zip the dist directory and send it to the client. For clients that use win95, win98 machines, They unpack the zip file and run the exe. The utility creates a text file that is sent to the printer with the statement below. os.system('type ' +FileName+ ' prn'), and the file prints. But, from an xp machine if I try to print using the same statement, I get a question on the dos screen which reads something like this; Which program authorized this operation? Since I don't have an xp machine, the statement above may not be exact, but you get the idea. The question I have is, first is there any way to work around the question asked by the xp machine using python. If not, I may have to register the package in xp, if registering the utility the only way, which package is the simplest to use. Also, if the utility is registered in xp, will the same statement send the file to the printer as it does in win98. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list
Re: Easiest way to print from XP/DOS.
Did you run from a file or type in from keyboard? When the client runs the utility program the output file is built but nothing prints and no messages appear. When I typed from keyboard on an xp pro at c:\, I got the message. Is it possible that virus detector or some self.defense software is interacting? On Friday 29 December 2006 17:58, Larry Bates wrote: jim-on-linux wrote: This is the situation I'm in. I've built a single file utility using py2exe. I zip the dist directory and send it to the client. For clients that use win95, win98 machines, They unpack the zip file and run the exe. The utility creates a text file that is sent to the printer with the statement below. os.system('type ' +FileName+ ' prn'), and the file prints. But, from an xp machine if I try to print using the same statement, I get a question on the dos screen which reads something like this; Which program authorized this operation? Since I don't have an xp machine, the statement above may not be exact, but you get the idea. The question I have is, first is there any way to work around the question asked by the xp machine using python. If not, I may have to register the package in xp, if registering the utility the only way, which package is the simplest to use. Also, if the utility is registered in xp, will the same statement send the file to the printer as it does in win98. jim-on-linux I don't get any such message on my XP Pro Service Pack 2 system here using your method. -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: writing serial port data to the gzip file
If someone hasn't already commented, Aside from any other problems, the file you are trying to write to is (opened)?? in the w mode. Every time a file is opened in the 'w' mode, everything in the file is deleted. If you open a file in the 'a' mode, then everything in the file is left untouched and the new data is appended to the end of the file. Your while loop is deleting everything in the file on each loop with the 'w' mode. try, vfile = open('vfile', 'a') rather than vfile = open('vfile', 'w') jim-on-linux http:\\www.inqvista.com while 1: g=gzip.GzipFile(/root/foofile.gz,w) while dataOnSerialPort(): g.write(data) else: g.close() On Sunday 17 December 2006 20:06, Petr Jakes wrote: I am trying to save data it is comming from the serial port continually for some period. (expect reading from serial port is 100% not a problem) Following is an example of the code I am trying to write. It works, but it produce an empty gz file (0kB size) even I am sure I am getting data from the serial port. It looks like g.close() does not close the gz file. I was reading in the doc: Calling a GzipFile object's close() method does not close fileobj, since you might wish to append more material after the compressed data... so I am completely lost now... thanks for your comments. Petr Jakes snippet of the code def dataOnSerialPort(): data=s.readLine() if data: return data else: return 0 while 1: g=gzip.GzipFile(/root/foofile.gz,w) while dataOnSerialPort(): g.write(data) else: g.close() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python, PostgreSQL, What next?
Before commiting to a RDBMS take a look at Gadfly. Depending on what you need a RDB for, (light duty), or (heavy duty) take a look at gadfly. Gadfly is made from all python code. Use stardard SQL statements like Select, Create and Drop Tables, etc. Newest version GadflyB5 http://gadfly.sourceforge.net/ jim-on-linux http://www.inqvista.com On Saturday 02 December 2006 11:33, Thomas Bartkus wrote: On Fri, 01 Dec 2006 23:04:37 -0800, vbgunz wrote: Hello all, I've studied Python and studied PostgreSQL. What is the absolute next best step to take to merge these two finely together? I've heard of SQLAlchemy and some others but before I dive in, I would really like the opinion of those who tried it and other toolkits. My main concern is, I would like to completely work with a database from Python. What would you suggest I look into? Let me venture that the biggest problem most people seem to have is that they endure great pain just to avoid learning SQL. SQL is a complete programming language in and of itself with a breadth and depth that most people miss. And it covers much terrain missed by Python. Which is a good thing because SQL and Python are perfect together. With this language mix you've got darn near everything licked. Get SQL in your head and all you will need would be the db-api interface with Postgres that Frederick Lundh pointed you to. All you want to do is throw SQL commands at Postgres and recover result sets into Python. It's a cinch. Thomas Bartkus -- http://mail.python.org/mailman/listinfo/python-list
Re: shtoom making PC2Phone calls
On Thursday 30 November 2006 12:35, Croteam wrote: Hello, Can somebody give me shtoom examples or source code for making PC2Phone calls and pc to pc calls. (if you give me source code,please give me full url to that source or send me to email: [EMAIL PROTECTED]) Thanks,I will really appreciate that Try, http://pyserial.sourceforge.net/ Many examples. I've used some of the examples to connect pc to pc. And with phone attached, you can to talk with someone on the other end. Search using serial port. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: shtoom making PC2Phone calls
Forgot to include, Check out pyserial-2-2 at sourceforge.net/ by Chris Liechti On Thursday 30 November 2006 21:07, jim-on-linux wrote: On Thursday 30 November 2006 12:35, Croteam wrote: Hello, Can somebody give me shtoom examples or source code for making PC2Phone calls and pc to pc calls. (if you give me source code,please give me full url to that source or send me to email: [EMAIL PROTECTED]) Thanks,I will really appreciate that Try, http://pyserial.sourceforge.net/ Many examples. I've used some of the examples to connect pc to pc. And with phone attached, you can to talk with someone on the other end. Search using serial port. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: odict the Ordered Diction 0.2.2
Thanks for the post, Its become a part time job keeping up with updates. jim-on-linux http://www.inqvista.com On Wednesday 29 November 2006 09:41, Fuzzyman wrote: After a break of almost a year there has been an update to `odict the Ordered Dictionary http://www.voidspace.org.uk/python/odict.html `_. The latest version is 0.2.2, with changes implemented by Nicola Larosa. Despite over 700 downloads since May (plus 1300 as part of `pythonutils http://www.voidspace.org.uk/python/pythonutils .html`_) there have been no bug reports, only improvements [#]_. {sm;:-)} * `Quick Download http://www.voidspace.org.uk/cgi-bin/voidspace/ downman.py?file=odict.py`_ What is odict? == **odict** is a pure Python implementation of an ordered dictionary. It keeps keys in insertion order and allows you to change the order. Methods (including iteration) that would return members in an arbitrary order are now ordered. There is also the `SequenceOrderedDict http://www.voidspace.org.uk/python/odict.html# sequenceordereddict`_ that behaves like a sequence as well as a dictionary. It allows slicing and the keys, values and items methods are special sequence objects (which are also callable and so behave as methods too). What's New ? == Code --- Removed the TODO and CHANGELOG sections in the tail docstring (they are in the docs anyway). Disabled warnings during tests. Explicitly disabled tests execution on Python v.2.2 . In addition to the slicing tests, other ones are failing. Removed code duplication between the ``__init__`` and the ``update`` methods. Misc. cleanup. Also, based on code from `Tim Wegener`_: - added the ``rename`` method; - removed a ``has_key`` usage in the ``__setitem__`` method. Documentation -- Moved the ISSUES chapter from code's tail docstring to here. Moved up the `Creating an Ordered Dictionary http://www.voidspace.org.uk/python/odict.html# creating-an-ordered-dictionary`_ chapter. Added prompts to the code examples and removed the superfluous print statements (sometimes they were there, sometimes they were not). Misc. cleanup. .. [#] So either no-one is using it, or it's really good... -- http://mail.python.org/mailman/listinfo/python-list
Re: Several entries on Tile and TableList at the Tkinter wiki
Thanks for posting this entry, The fact that a wiki or help site doesn't get a lot of traffic is not an necessarily an indicator of it's usfulness. It indicates to me that the product, in this case Tkinter, may be easy to use and understand, after working with it a little, A lot of help may not be necessary. A good example is the py2exe help site. At one time not to long ago there might be 8 to 12 post per day, or more. Today by my unscientific count method, I don't think there are more than 3 to 4 post per week. Yet, py2exe and Tkinter is almost as valuable as Python. If we couldn't build programs for Windows, where would a python programmes's money come from? Thanks again, jim-on-linux http://www.inqvista.com On Sunday 26 November 2006 15:50, Kevin Walzer wrote: I'm not sure how often members of this list visit the Tkinter wiki at http://tkinter.unpythonic.net/wiki/FrontPage; this wiki seems to have less traffic in general than the Tcl/Tk wiki at http://wiki.tcl.tk. Given that, I hope it's not out of line for me to call attention to several pages that I've posted about integrating Tile (http://tktable.sourceforge.net/tile) and TableList (http://www.nemethi.de, http://wiki.tcl.tk/5527) into Tkinter applications. I've noted a serious lack of resources/documentation about these two powerful Tk components. In addition to some documentation, screenshots, and sample applications, I've posted updated versions of the original TableList and Tile wrappers by Martin Franklin. I should take this moment to thank Mr. Franklin for his work on these wrappers; whatever I added to them was pretty minimal compared to the heavy lifting he did. He originally posted them on the Internet last year, but the site that hosted them has gone dark. Anyway, Mr. Franklin, if you are reading this, thank you for your hard work; it has been enormously helpful. I hope my own efforts extend your work and make it even more useful for other Tkinter developers. Here are the links: http://tkinter.unpythonic.net/wiki/UsingTile http://tkinter.unpythonic.net/wiki/TileWrapper http://tkinter.unpythonic.net/wiki/TableListWra pper http://tkinter.unpythonic.net/wiki/TableListTil eWrapper http://tkinter.unpythonic.net/wiki/PyLocateTile http://tkinter.unpythonic.net/wiki/PyLocate Hope these prove useful to others, as starting points for your own work if nothing else. Corrections and improvements are of course invited; it's a wiki! -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
On Friday 24 November 2006 03:30, John Machin wrote: jim-on-linux wrote: GinTon, I think this is what you want. class Kdoi: Is that a typo? No, it's a style. life seems to be easier to me if one is consistent, all my classes begin with K. def __init__(self) : self.Fdo() What is all this K and F stuff? It's my style. life seems to be easier to me if one is consistent all my function begin with F. I started doing things like this when the only way to debug was to read each line of code and try to figgure out if it was the problem. They are my personal sign posts. def Fdo(self): searchterm = 'help' print searchterm #local self.searchterm = searchterm print self.searchterm #used inside the class Kdo.searchterm = searchterm # print Kdo.searchterm #used outside the class Kdomore() class Kdomore(Kdo): def __init__(self) : self.Fdomore() def Fdomore(self): searchterm = Kdo.searchterm # print searchterm It's not apparent what the print statements are for -- are they part of an attempt to debug your code? print shows the results wherever a print statement turns up the results = 'help' . I didn't run the code, and it has it has a coding error but if removed, the results should be; searchterm = 'help' self.searchterm = 'help' Kdo.searchterm = 'help' Sound silly but many people have trouble with getting a variable from here to there in their code. This shows that it can be done What gives you the idea that this is what the OP wants or needs? If I remember right, he refrased his first question and asked a second one. Sometimes people don't take the time to write correctly, the questions that are really in their mind. So I guessed. If Im wrong, he will ignore it. If I'm right, he will use it. Also, I have found that other will latch on to the ideas presented in these email responses. And they will use them, even though the response was not exactly what the original emailer wanted. And, I sometimes I do use print statements to debug, I have used other ways but on linux, I prefer a print statement. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
On Friday 24 November 2006 13:01, jim-on-linux wrote: On Friday 24 November 2006 03:30, John Machin wrote: jim-on-linux wrote: GinTon, I think this is what you want. class Kdoi: Is that a typo? No, it's a style. life seems to be easier to me if one is consistent, all my classes begin with K. Sorry, Kdoi should be Kod def __init__(self) : self.Fdo() What is all this K and F stuff? It's my style. life seems to be easier to me if one is consistent all my function begin with F. I started doing things like this when the only way to debug was to read each line of code and try to figgure out if it was the problem. They are my personal sign posts. def Fdo(self): searchterm = 'help' print searchterm #local self.searchterm = searchterm print self.searchterm #used inside the class Kdo.searchterm = searchterm # print Kdo.searchterm #used outside the class Kdomore() the line above should be Kdomore(), not class Kdomore() (For the technocrats) class Kdomore(Kdo): def __init__(self) : self.Fdomore() def Fdomore(self): searchterm = Kdo.searchterm # print searchterm It's not apparent what the print statements are for -- are they part of an attempt to debug your code? print shows the results wherever a print statement turns up the results = 'help' . I didn't run the code, and it has it has a coding error but if removed, the results should be; searchterm = 'help' self.searchterm = 'help' Kdo.searchterm = 'help' Sound silly but many people have trouble with getting a variable from here to there in their code. This shows that it can be done What gives you the idea that this is what the OP wants or needs? If I remember right, he refrased his first question and asked a second one. Sometimes people don't take the time to write correctly, the questions that are really in their mind. So I guessed. If Im wrong, he will ignore it. If I'm right, he will use it. Also, I have found that other will latch on to the ideas presented in these email responses. And they will use them, even though the response was not exactly what the original emailer wanted. And, I sometimes I do use print statements to debug, I have used other ways but on linux, I prefer a print statement. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
On Friday 24 November 2006 13:20, jim-on-linux wrote: On Friday 24 November 2006 13:01, jim-on-linux wrote: On Friday 24 November 2006 03:30, John Machin wrote: jim-on-linux wrote: GinTon, I think this is what you want. class Kdoi: Is that a typo? No, it's a style. life seems to be easier to me if one is consistent, all my classes begin with K. Sorry, Kdoi should be Kod Sorry again Kdoi should be Kdo (Haste makes waste.) def __init__(self) : self.Fdo() What is all this K and F stuff? It's my style. life seems to be easier to me if one is consistent all my function begin with F. I started doing things like this when the only way to debug was to read each line of code and try to figgure out if it was the problem. They are my personal sign posts. def Fdo(self): searchterm = 'help' print searchterm #local self.searchterm = searchterm print self.searchterm #used inside the class Kdo.searchterm = searchterm # print Kdo.searchterm #used outside the class Kdomore() the line above should be Kdomore(), not class Kdomore() (For the technocrats) class Kdomore(Kdo): def __init__(self) : self.Fdomore() def Fdomore(self): searchterm = Kdo.searchterm # print searchterm It's not apparent what the print statements are for -- are they part of an attempt to debug your code? print shows the results wherever a print statement turns up the results = 'help' . I didn't run the code, and it has it has a coding error but if removed, the results should be; searchterm = 'help' self.searchterm = 'help' Kdo.searchterm = 'help' Sound silly but many people have trouble with getting a variable from here to there in their code. This shows that it can be done What gives you the idea that this is what the OP wants or needs? If I remember right, he refrased his first question and asked a second one. Sometimes people don't take the time to write correctly, the questions that are really in their mind. So I guessed. If Im wrong, he will ignore it. If I'm right, he will use it. Also, I have found that other will latch on to the ideas presented in these email responses. And they will use them, even though the response was not exactly what the original emailer wanted. And, I sometimes I do use print statements to debug, I have used other ways but on linux, I prefer a print statement. jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
On Friday 24 November 2006 13:41, John Machin wrote: jim-on-linux wrote: On Friday 24 November 2006 03:30, John Machin wrote: jim-on-linux wrote: GinTon, I think this is what you want. class Kdoi: Is that a typo? No, it's a style. life seems to be easier to me if one is consistent, all my classes begin with K. and end with i? def __init__(self) : self.Fdo() What is all this K and F stuff? It's my style. life seems to be easier to me if one is consistent all my function begin with F. You left out a word; the correct way of phrasing that is: All my function _are_ begin with F :-) No, for Non-Hungrian programmers it's all-ah me Functions gona begin witha F, not Func. anda all-ah-me classes gona begin witha K, not Klas. Anda only me gona Know the Fdiff cause me codea is not opena. Anda I finda that it savea me time causea I doa thisa way fora a longa time. Whena I gonna hava to changea maybe I willa. This appears to be a variation on Hungarian notation; google that for opinions pro con. In a certain vernacular, it would be called an effed concept :-) I started doing things like this when the only way to debug was to read each line of code and try to figgure out if it was the problem. When was that? That was when bill gates just left Harvard, basic was brand new, and 4k of memory was installed free when you bought a computer, (TRS80), my first,. Assemble was the alternative to Basic and you had to backup on tape because floppies didn't exist. And, most people on this site wern't even a gleem in their fathers eye. Even years ago, there were slightly better ways. For example, my first boss' boss was an enthusiastic coder and debugger and also a workaholic. Colleagues who lived along the same railway line as he and were foolish enough not to hide behind a newspaper could have their morning or evening reverie disturbed by a cry of Glad you're here! I'll hold the listing, you hold the dump!. I get the impression that debugging techniques have moved along a little bit since then. :-) They are my personal sign posts. def Fdo(self): searchterm = 'help' print searchterm #local self.searchterm = searchterm print self.searchterm #used inside the class Kdo.searchterm = searchterm # print Kdo.searchterm #used outside the class Kdomore() class Kdomore(Kdo): def __init__(self) : self.Fdomore() def Fdomore(self): searchterm = Kdo.searchterm # print searchterm It's not apparent what the print statements are for -- are they part of an attempt to debug your code? print shows the results wherever a print statement turns up the results = 'help' . I didn't run the code, and it has it has a coding error I noticed. but if removed, the results should be; searchterm = 'help' self.searchterm = 'help' Kdo.searchterm = 'help' Correct but when writing one must be clear. Would it be better for me to write, your question above was Is that a typo? Or is it better if I were to write, your question above, Is that a typo?, is a legimate question, but not clear. So, to be clear one might write is Kdoi correct?. A clear response would be, it is not Kdoi, it is Kdo. But that's not correct either, it is Kdo. If one runs the code I don't expect the user to look for help, I think we will see help and will THINK that the results are correct. THINK is also incorrect, it should be written. think, or should it? No, the result would be help help help Plug in a text-to-speech module and a phone dialer and you're done ;-) Sound silly but many people have trouble with getting a variable from here to there in their code. This shows that it can be done What gives you the idea that this is what the OP wants or needs? If I remember right, he refrased his first question and asked a second one. Sometimes people don't take the time to write correctly, the questions that are really in their mind. So I guessed. If Im wrong, he will ignore it. If I'm right, he will use it. With luck. Kindly consider another possibility: that you are wrong (or just marching to the beat of your own tambourine) and he (or she) is a newbie will use it :-) Because he being of course judge of that tendency will make his opinions the rule of judgment, and approve or condemn the sentiments of others only as they shall square with or differ from his own… Thomas Jefferson I enjoied this, but time is money, jim-on-linux http://www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
The TRS-80 I bought came with both Basic and Assembly Language teaching guides, and that was it. To make the machine work one had to program. I didn't mean to imply that Bill Gates developed it. It's well known that MS borrowed stuff when they needed to from where ever the could get it. That's business. I'm not an MS fan but Bill Gates was the one who gave away a very cheep, borrowed but improved, copy of DOS to computer sellers. These copies could also be copied to floppies (8 inch). So, DOS 3.3 was used by computer sellers, to install DOS on the buyers machine, (intel 286) free. On the other hand, IBM sold the same package for $50.00. I got the free copy of MS 3.3 with my 286. After that, Windows 3.0 cost me $25.00, Windows 3.1 cost me $30.00, DOS upgrade from3.3 to 6.22 cost me $55.00. Since then I purchased Win 95, $100.00 and Win 98. $125.00. And, all for testing software that I produced for people that use that stuff. Bill Gates probably can't program any software to write Hello World on any screen, but I'll bet he knows how to fill out a deposit ticket. I think Bill Gates recognize early that the money is in the marketing of the product, not the programming of it. How else can you explain the success of Windows, like it or not? jim-on-linux http://www.inqvista.com On Friday 24 November 2006 17:18, Dennis Lee Bieber wrote: On Fri, 24 Nov 2006 16:56:58 -0500, jim-on-linux [EMAIL PROTECTED] declaimed the following in comp.lang.python: That was when bill gates just left Harvard, basic was brand new, and 4k of memory was Pardon? I'd learned BASIC back around 1972, in the 9th grade, using an ASR-33 with dial-up to some company's Honeywell-Bull system. BASIC is one of the ancients in languages, predating Pascal and C. Just because Gates managed to scrabble together a BASIC interpreter for the MITS Altair, and then had it picked up by other makers of 8080/Z-80 based microcomputers doesn't make it brand new. (Personally, I suspect he hasn't done any programming ever since that day, and is probably still trying to find some way to sue KemenyKurtz (sp?s) over their own creation) -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED] HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff:[EMAIL PROTECTED]) HTTP://www.bestiaria.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
GinTon, I think this is what you want. class Kdoi: def __init__(self) : self.Fdo() def Fdo(self): searchterm = 'help' print searchterm #local self.searchterm = searchterm print self.searchterm #used inside the class Kdo.searchterm = searchterm # print Kdo.searchterm #used outside the class Kdomore() class Kdomore(Kdo): def __init__(self) : self.Fdomore() def Fdomore(self): searchterm = Kdo.searchterm # print searchterm jim-on-linux http://www.inqvista.com On Thursday 23 November 2006 17:09, GinTon wrote: Sorry, I mean access to local variable from a method import module method(value) I would to access to values that are created locally in that method Fredrik Lundh ha escrito: GinTon wrote: How to access to a variable (that value is not returned) from a module imported? And the variable is set at the module-level. import module print module.variable (have you read the Python tutorial?) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Caution newbie question: python window to stay open ?
Michael, put this at the top of your code. After the window closes read the testLog.out file. It may give you a clue as to what is happening. sys.stdout = open('testLog.out', 'w') jim-on-linux http://www.inqvista.com On Tuesday 21 November 2006 22:20, mkengel wrote: Caution: newbie question I am using python 2.4.3-11 on Windows XP. Problem: Python window closes immediately after executing a *.py file (e.g. containing a print... command. What do I have to do to keep it open to see the results ? Interactive window stays open. Thank you. Michael -- http://mail.python.org/mailman/listinfo/python-list
Re: Press button to load data
On Friday 17 November 2006 02:58, you wrote: On Fri, 17 Nov 2006 00:25:39 -0500, jim-on-linux [EMAIL PROTECTED] declaimed the following in comp.lang.python: Without being able to run the code my question is where is the id in the lambda defined? Please take into account that I've not actually used lambdas, so might have some mistakes in the syntax... for bill in shelvename: global funcs bill1 = Button(None, text= shelvename[bill].name, font=('bold',10),command=(lambda x = id: fetchRecord(x))) id would be something that identifies the button... In this case, maybe you can use bill: Think about relating a Tkinter variable to each button then the button is related to a unique variable. ( Tkinter StingVar or IntVar or some others.) Then you will have to keep the variables in a list or dictionary for recalling. jim-on-linux http://www.inqvista.com ... command=(lambda x = bill: fetchRecord(x)) ... As I understand the lambda syntax, what this does is create a function (which is the command that gets run when the button is pushed), and this function will call fetchRecord passing it the value that x had at the time of definition (hence the x=...) -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED] HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff:[EMAIL PROTECTED]) HTTP://www.bestiaria.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Press button to load data
Without being able to run the code my question is where is the id in the lambda defined? On Thursday 16 November 2006 22:31, jim wrote: Thanks for your help, but now I have a another problem so here is my code again when I run this it prints built-in function id from Tkinter import * import shelve from tkMessageBox import showerror shelvename = shelve.open('class-shelve2') cat = (' Name ', ' Account # ', ' Amount Due ', ' Date Due ') def NameFields(top): name1 = Label(None, text=cat[0], relief=RIDGE, width=20, fg='blue', bg='white', font=('bold',15)) name2 = Label(None, text=cat[1], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name3 = Label(None, text=cat[2], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name4 = Label(None, text=cat[3], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name1.grid(row=0, column=0, sticky=NSEW) name2.grid(row=0, column=1, sticky=NSEW) name3.grid(row=0, column=2, sticky=NSEW) name4.grid(row=0, column=3, sticky=NSEW) top.columnconfigure(0, weight=1) top.columnconfigure(1, weight=1) top.columnconfigure(2, weight=1) top.columnconfigure(3, weight=1) def DisplayBills(top): c=0 x = [] global bill for bill in shelvename: global funcs bill1 = Button(None, text= shelvename[bill].name, font=('bold',10),command=(lambda x = id: fetchRecord(x))) bill2 = Label(None, text= shelvename[bill].account, relief=RIDGE, font=('bold',10)) bill3 = Label(None, text= shelvename[bill].paymentDue, relief=RIDGE, font=('bold',10), fg='red') bill4 = Label(None, text= shelvename[bill].dateDue, relief=RIDGE, font=('bold',10)) bill1.grid(row=c, column=0, sticky=NSEW) bill2.grid(row=c,column=1, sticky=NSEW) bill3.grid(row=c,column=2, sticky=NSEW) bill4.grid(row=c,column=3, sticky=NSEW) c = c + 1 return bill def fetchRecord(x): print x top = Tk() DisplayBills(top), NameFields(top) mainloop() jim-on-linux wrote: Just from a glance my thoughts are to start with one file and build on it. Make a class of it so you can loop it to use it over for each record. You wrote that the info was in a file on the hd. If it is in a file on the hd, use the open() function, read from the file, only one record and write the data to a list. You can incorporate the button option, command = CallSomeFunction, to call a function that builds a window, and loads the data into labels or entry boxes. If you are going to modify the data, entry boxes allow you to modify it and save it back to a file. Also, when using the open() function, close it after you get the data you need. otherwise you may experience unexpected problems. client = open('client', 'r') client.read() (readline()) (readlines()) client.close() jim-on-linux http//:www.inqvista.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Press button to load data
Just from a glance my thoughts are to start with one file and build on it. Make a class of it so you can loop it to use it over for each record. You wrote that the info was in a file on the hd. If it is in a file on the hd, use the open() function, read from the file, only one record and write the data to a list. You can incorporate the button option, command = CallSomeFunction, to call a function that builds a window, and loads the data into labels or entry boxes. If you are going to modify the data, entry boxes allow you to modify it and save it back to a file. Also, when using the open() function, close it after you get the data you need. otherwise you may experience unexpected problems. client = open('client', 'r') client.read() (readline()) (readlines()) client.close() jim-on-linux http//:www.inqvista.com On Wednesday 15 November 2006 23:20, [EMAIL PROTECTED] wrote: I'm new to Python, and programming in general. What I'm trying to do here is to load a list of accounts from a file on my harddrive into a string of Buttons in Tkinter, and when I press one of the Buttons, which has one of my account name, it will load that account into a new window. But I don't understand how to code the proccess that would tell the program what account is selected. Any help with this would be very appreciated. Thanks in advance. from Tkinter import * import shelve from tkMessageBox import showerror shelvename = shelve.open('class-shelve2') cat = (' Name ', ' Account # ', ' Amount Due ', ' Date Due ') def NameFields(top): name1 = Label(None, text=cat[0], relief=RIDGE, width=20, fg='blue', bg='white', font=('bold',15)) name2 = Label(None, text=cat[1], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name3 = Label(None, text=cat[2], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name4 = Label(None, text=cat[3], relief=RIDGE, width=15, fg='blue', bg='white', font=('bold',15)) name1.grid(row=0, column=0, sticky=NSEW) name2.grid(row=0, column=1, sticky=NSEW) name3.grid(row=0, column=2, sticky=NSEW) name4.grid(row=0, column=3, sticky=NSEW) top.columnconfigure(0, weight=1) top.columnconfigure(1, weight=1) top.columnconfigure(2, weight=1) top.columnconfigure(3, weight=1) def DisplayBills(top): c=0 for bill in shelvename: bill1 = Button(None, text= shelvename[bill].name, font=('bold',10), command=fetchRecord) bill2 = Label(None, text= shelvename[bill].account, relief=RIDGE, font=('bold',10)) bill3 = Label(None, text= shelvename[bill].paymentDue, relief=RIDGE, font=('bold',10), fg='red') bill4 = Label(None, text= shelvename[bill].dateDue, relief=RIDGE, font=('bold',10)) bill1.grid(row=c, column=0, sticky=NSEW) bill2.grid(row=c,column=1, sticky=NSEW) bill3.grid(row=c,column=2, sticky=NSEW) bill4.grid(row=c,column=3, sticky=NSEW) c = c + 1 def fetchRecord(): top = Tk() DisplayBills(top), NameFields(top) mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python deployment options
Rooy, If you are still having problems with py2exe, I suggest you start with the simplest program you can build and include everything in one file. Make that work like the simple examples in the py2exe samples. jim-on-linux http://www.inqvista.com On Wednesday 08 November 2006 22:04, Hieu Hoang wrote: Hi list, I have packaged a few pygames to one exe file with pyinstaller ( http:/ /pyinstaller.python-hosting.com/ ), sent them to my friends and the executables work. Running them shows a Fatal Error dialog box with only MSVCR71.DLL, but nothing breaks, despite whether the system has python or not. I haven't been able to figure out py2exe setup script yet, so I can't compare them. Hope this helps, Rooy -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter check box behaviour - Windows / Linux discrepancy
Peter, You already have an answer to you question but if you want to fancy up your program you could replace; self.chkTest.bind('ButtonRelease-1', self.chkTest_click) with self.chkTest.bind('f2',self.chkTest_click0) or some other acceptable key from the keyboard def chkTest_click0(self,event): self.chkTest_click() def chkTest_click(self): # read check box state and display appropriate text if self.intTest.get()==0: self.lblTest.config(text='Check box cleared') else: self.lblTest.config(text='Check box set') jim-on-linux http://www.inqvista.com On Thursday 09 November 2006 18:28, peter wrote: I've come across a weird difference between the behaviour of the Tkinter checkbox in Windows and Linux. The issue became apparent in some code I wrote to display an image in a fixed size canvas widget. If a checkbox was set then the image should be shrunk as necessary to fit the canvas while if cleared it should appear full size with scrollbars if necessary. The code worked fine under Linux (where it was developed). But under Windows, the first click in the checkbox did nothing, then subsequent clicks adjusted the size according to the PREVIOUS, not the current, checkbox state. I've isolated the problem in the code below, which shows a single checkbox and a label to describe its state. It works ok under Linux, but in Windows it is always one click behind. Any ideas? I am using Linux: Fedora Core 3, Python 2.3.4 Windows: Windows NT, Python 2.3.4 Peter === = import Tkinter as tk class App: def __init__(self,frmMain): Demonstrate difference in Windows / Linux handling of check box Text in lblTest should track check box state # Set up form self.intTest=tk.IntVar() self.chkTest=tk.Checkbutton(frmMain,text='Click me!',variable=self.intTest) self.chkTest.grid(row=0,column=0,padx=5,pady=5, sticky=tk.W) self.chkTest.bind('ButtonRelease-1',self.chkT est_click) self.lblTest=tk.Label(frmMain,text='Dummy') self.lblTest.grid(row=1,column=0,padx=5,pady=5, sticky=tk.W) self.chkTest_click() # so as to initialise text def chkTest_click(self,event=None): # read check box state and display appropriate text if self.intTest.get()==0: self.lblTest.config(text='Check box cleared') else: self.lblTest.config(text='Check box set') if __name__=='__main__': frmMain=tk.Tk() app=App(frmMain) frmMain.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Error:IndentationError: expected an indented block
try this def DoCsubnet1 (action, subject, target, args): pass jim-on-linux http://www.inqvista.com On Wednesday 08 November 2006 10:47, Antonios Katsikadamos wrote: hi all. I try to run an old python code and i get the following message File /home/antonis/db/access.py, line 119 def DoCsubnet1 (action, subject, target, args): # DoC servers net ^ IndentationError: expected an indented block 1) and I don't know what causes it. I would be grate full if you could give me a tip. 2) how can i overcome it? Can i use the keyword pass?and if how ccan i use it Kind regards, Antonios -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Tkinter problem
Greg, Run the following code to see how pack_forget() or grid_forget() works, it makes previous widgets disappear but not go away. If you call grid() or pack() again after using grid_forget() the widget returns. root = Tk() class Ktest: def __init__(self): self.Ftest1() def Ftest1(self): try: self.test2.grid_forget() except AttributeError : pass self.test1 = Button(root, text='Push #1 button', bg = 'yellow', width = 25, command = self.Ftest2, height = 25) self.test1.grid(row=0, column=0) def Ftest2(self): self.test1.grid_forget() self.test2 = Button(root, text='Push #2 button', bg = 'green', width = 15, command = self.Ftest1, height = 10) self.test2.grid(row=0, column=0) if __name__== '__main__' : Ktest() mainloop() Maybe someone else has an idea about not defining a variable. My question is how does a budket of wires and screws know its a bucket of wires and screws unless someone tells it that it's a bucket of wires and screws? On Tuesday 07 November 2006 09:35, [EMAIL PROTECTED] wrote: Hi all, I'm trying to write a GUI that will put up multiple widgets in succession. My problem is that each widget also contains the previous widgets when they pop up. How do I reinitialize the widget each time so that it doesn't contain earlier ones? Actually, another question I have is, is there a way to set python so that it will assume any undefined variable is 0 or ''? That is, I have several statements like If k 0 then so and so and I would like it to assume k=0 unless I tell it otherwise. I've just been defining k=0 at the start of the program but it seems there should be a better way. Greg -- http://mail.python.org/mailman/listinfo/python-list