Re: Windows, IDLE, __doc_, other
Add to this. Isn't there a way to see the arguments and descriptions of functions? -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Python to Execute a C or FORTRAN Program (Windows)
sturlamolden wrote: On 17 Des, 03:41, W. eWatson wolftra...@invalid.com wrote: His program was originally written in Python, but a new hardware device (capture card) had no good interface with Python, so he wrote it in C++, which does. From my knowledge of the Python program before the entry of c++, it seems he could have farmed out the hardware interface in much the same way he had done it before with a capture card well know to him. This sounds a bit incompetent. Why didn't he just write an extension module in C++? Also, if you don't know how to spawn a subprocess, I'd question your competence as well. I can't read his mind. -- http://mail.python.org/mailman/listinfo/python-list
Re: Either IDLE Can't Start a subprocess or a firewall software firewall is blocking the connection (Win)--Battlin McAfee
Alf P. Steinbach wrote: * W. eWatson: See Subject msg from Python 2.5 Win XP. It is preceded by a Socket Error. It happened while I had a simple program displayed, and I wanted to see the shell. The msg occurred when I pressed Shell on Run from the menu. I played around for awhile, but got nowhere. Same msg. I did remove my McAfee firewall protection, and it worked once, but reverted to not working. I rebooted and the first time I could use Shell, it succeeded. After that it failed. Comments? Geeze! Mcaffe turned on the firewall again after the reboot. All seems well now. Nope. McAfee turned the firewall back on. It decided to warn me it was off, but now has allowed me to ignore the fact it is no longer protecting me. I'll just let Win firewall do that, thank you. Nope it's back. I'll just stop here and let anyone who wants to just chime in. If I get it to stop, I'll be back. I recall vaguely some similar problem caused by a program attempting to connect to localhost, and the solution then was to edit the hosts file (don't ask me for details, but perhaps that'll help you search: that problem had entirely to do with Windows' very over-zealous security measures). Cheers hth., - Alf As it turns out, I can sneak around it, so I'm putting it aside. -- http://mail.python.org/mailman/listinfo/python-list
Either IDLE Can't Start a subprocess or a firewall software firewall is blocking the connection (Win)--Battlin McAfee
See Subject msg from Python 2.5 Win XP. It is preceded by a Socket Error. It happened while I had a simple program displayed, and I wanted to see the shell. The msg occurred when I pressed Shell on Run from the menu. I played around for awhile, but got nowhere. Same msg. I did remove my McAfee firewall protection, and it worked once, but reverted to not working. I rebooted and the first time I could use Shell, it succeeded. After that it failed. Comments? Geeze! Mcaffe turned on the firewall again after the reboot. All seems well now. Nope. McAfee turned the firewall back on. It decided to warn me it was off, but now has allowed me to ignore the fact it is no longer protecting me. I'll just let Win firewall do that, thank you. Nope it's back. I'll just stop here and let anyone who wants to just chime in. If I get it to stop, I'll be back. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Python to Execute a C or FORTRAN Program (Windows)
Mensanator wrote: On Dec 14, 8:14�pm, W. eWatson wolftra...@invalid.com wrote: I think Python is capable of executing a compiled C or FORTRAN program, Sure, if it was compiled to an .exe file. and maybe even getting some parameters passed back. Sure, if the program prints to stdout. Does anyone have a example of how this might be done? I'm running under Win XP Pro. Here's one. The test program is factor.exe (included in the MIRACL library). I recompiled it (factor!.exe) to produce consitent output. ... Thanks. OK, I think I can follow that. I want to pass it along to someone who either missed this possibility in some coding, ignored it, or felt more comfortable about just writing the whole program from scratch in c++. His program was originally written in Python, but a new hardware device (capture card) had no good interface with Python, so he wrote it in C++, which does. From my knowledge of the Python program before the entry of c++, it seems he could have farmed out the hardware interface in much the same way he had done it before with a capture card well know to him. Would the same Python interface work for a compiled C++ program? -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the significance of after() in this code?
Martin P. Hellwig wrote: W. eWatson wrote: See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) If you are talking tkinter here, it is an alarm callback. See http://effbot.org/tkinterbook/widget.htm Very good. I recall encountering this once before. I knew it had to be something like that, since the code does not provide a method called after(). -- http://mail.python.org/mailman/listinfo/python-list
Why Doesn't XP Pro Show Size, Time and Date Mod of a Created File?
I created a folder, and wrote a file to it. When I look at what files are in it, they are correct. However, The Size, Type, and Date Mod are not shown. Why am I missing those columns? I'm writing files with a suffix of dat, which seem only to match up with video CD movie. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Doesn't XP Pro Show Size, Time and Date Mod of a Created File?
Mensanator wrote: On Dec 5, 11:38�pm, W. eWatson wolftra...@invalid.com wrote: I created a folder, and wrote a file to it. When I look at what files are in it, they are correct. However, The Size, Type, and Date Mod are not shown. Why am I missing those columns? I'm writing files with a suffix of dat, which seem only to match up with video CD movie. Got to the View menu and select Details. Once in the Details view, click on the column headings and select which details to view. That's strange. I had gone to details before without any luck, but now it's showing the above columns. -- http://mail.python.org/mailman/listinfo/python-list
What is the significance of after() in this code?
See Subject. def StackImages(self): self.Upload(P) self.after_id = self.master.after(1,self.GetFrameOne) -- http://mail.python.org/mailman/listinfo/python-list
Why Can't I Delete a File I Created with Win XP?
I'm trying to store analytic data in a folder called Analysis. If the user doesn't have the folder, I make one for him, and then write a txt file into it. In this case a histogram of values, x and frequency. However, it appears that I made a mistake somewhere and cannot delete it using the Win XP delete. Here's the code that determines if Analysis exists, and whether to create it. print Path for Histogram, self.current_path s = self.current_path s = Analysis s = os.path.join(Analysis,s) print s joined ,s- debug print if not os.path.exists(Analysis): os.mkdir(Analysis) f = file( s, wb) if not f: self.LogError( Histogram file creation error 1 ) return False In writing the code to handle all of this, I forgot to write the txt folder to the file, nor did I close it. It was someone else's code, and I got caught up in the creation of Analysis. Here's what XP tells me when I try to delete the folder. Very funny. I just tried it to get the content of the msg, and XP deleted it. Let me recreate it and try again. OK, here it is: Error Deleting Folder or File. Cannot delete Analysis: It is being used by another person or program. Close programs that might be using it and try again. There is no file created, just the folders Analysis\Analysis. One too many. The second Analysis shows as an icon for a file of size 0KB. I printed with the debug print above: Path for Histogram Events\v20070206_055012.06.dat s joined Analysis\Analysis Analysis\Analysis should only be Analysis. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Can't I Delete a File I Created with Win XP?
The program code is not mine, but I wanted to modify it to produce an Analysis folder when the user wants histogram file, basically, a txt file to appear in Analysis. Elsewhere in the program this is done for another type of data that is directed to an Events folder. I figured I could copy the code from there and use it here. Here's other code for Events. # He's building a time stamp for the file name. # I'll use this with a slight modification to the name in # my code millisecs = int((event_time - int(event_time))*100) s = v%4d%02d%02d_%02d%02d%02d.%02d.dat % ( t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, millisecs ) #OK, he's got the file name assembled s = os.path.join(Events,s) if not os.path.exists(Events): os.mkdir(Events) f = file( s, wb ) if not f: self.LogError( File creation error 1 ) return False I caused the redundancy by just changing the meaning of s with a new statement below it. I should have commented the first one out. Yeah, I probably screwed up here and should have and,for purposes of debugging, just used another file name like s=ADATAFILE2009_mmdd.txt, which does not exist at this point of the coding stage. So I should have produced Analysis\ADATAFILE2009_mmdd.txt. If I had done that then I would have ended up with an empty file in the Analysis folder. However, even at that, why can't I delete this empty file called Analysis? When I said I was able to get rid of the file, it's probably because I had rebooted at some time after I puzzled over the problem, and now OS somehow released it's grip, that is, whatever process was trying to use the file too. John Machin wrote: On Dec 5, 9:57 pm, W. eWatson wolftra...@invalid.com wrote: [snip] s = self.current_path s referred to something ... s = Analysis but now s refers to Analysis ... at best, there is redundant confusing code; at worst, the source of your problem. s = os.path.join(Analysis,s) and now s refers to rAnalysis\Analysis (on your platform) print s joined ,s- debug print [snip] There is no file created, just the folders Analysis\Analysis. One too many. The second Analysis shows as an icon for a file of size 0KB. I printed with the debug print above: Path for Histogram Events\v20070206_055012.06.dat s joined Analysis\Analysis should only be Analysis. Huh?? s = os.path.join(fubar, fubar) should produce rfubar \fubar (as documented) ... If you don't want s to refer to rAnalysis \Analysis, then quite simply don't do that! -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Can't I Delete a File I Created with Win XP?
J wrote: On Sat, Dec 5, 2009 at 20:32, J dreadpiratej...@gmail.com wrote: connections eventually. So being able to find who has a lock on a given file or directory if the program dies unexpectedly would be useful. Google tells me that the program Process Explorer from SysInternals will provide most of the functionality of lsof... so I'll look into that and see if it will work. Certainly will help once I start opening and writing output files with my python scripts on Windows systems... What I'm trying to do is really simple. In the Win XP NG, I have two suggestions to get rid of the Analysis folder and the empty file in it. One is to use a program like you suggested, and the other is to delete it from DOS. I just tried cmd prompt, but was not successful. My DOS skills are long gone, so I have no idea if there is something I overlooked there. I bored down to Analysis and the into it. DIR showed an unnamed empty file, so I tried DEL *. I seriously doubt it was removed. Well, I'm going to reboot sometime later this evening, and knock it out as I described I was able to do once before after a reboot. Thne I'm going to fix the Python program and write a file correctly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Can't I Delete a File I Created with Win XP?
The original program and code are not mine. I have no idea if that specific piece of code has ever been tested. Generally the program works quite well, and when needed creates the Events folder without any difficulty. That folder is used heavily by writing new data files to it thousands of times over a month. I'm trying to do a very simple thing. I go to the Analysis folder, and try to use Win XP Pro to delete the empty and unnamed file in it. One just does a right-click on the empty file, and then uses Delete. It won't let me delete it. If I back up to the folder level, it won't let me delete the folder, since it's not empty. See the post I made to J moments ago. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Can't I Delete a File I Created with Win XP?
J wrote: On Sat, Dec 5, 2009 at 21:14, W. eWatson wolftra...@invalid.com wrote: What I'm trying to do is really simple. In the Win XP NG, I have two suggestions to get rid of the Analysis folder and the empty file in it. One is to use a program like you suggested, and the other is to delete it from DOS. I just tried cmd prompt, but was not successful. My DOS skills are long gone, so I have no idea if there is something I overlooked there. I bored down to Analysis and the into it. DIR showed an unnamed empty file, so I tried DEL *. I seriously doubt it was removed. Well, I'm going to reboot sometime later this evening, and knock it out as I described I was able to do once before after a reboot. Thne I'm going to fix the Python program and write a file correctly. And those are your only options, really. From what I've been able to see, there is no native ability in Linux to actually see who has a lock on a file that's been opened. And I completely understand your frustration. I've not used the process explorer program, so I really can't say how well it works for this kind of thing. But every post I found searching for this indicates that it will at least tell you what still has a lock on the file and maybe then you can figure out what needs to be closed from there. Rebooting should always work in cases like this. Rebooting the system should clear all file locks and is a last resort for a persistent stale file lock. So yeah, by rebooting, you'll always be able to release the lock on that file and then delete it once the system is back and running. However, that's not something you'd want to do on a production system except as a last resort. At least, that's not something that I'd want to do. So anyway, since you said the code is not yours, does the code actually close the files anywhere? I'm assuming that it does at some point, but if not, that really is something that needs to be added in. As I said in my last post, I am just a novice in the Python stuff, but I've written enough code in my life to know that you never assume that a file will be closed properly by the system once the program is finished running. I'm not saying that YOU specifically are doing this, but just making the suggestion as this is the kind of problem that can happen. Of course, a program that's dying for some reason is a different story... :-) Well, I'm pretty well done now. I fixed the program so it would write the file and close it. It did this successfully. I'll worry about getting the oddball file deleted later. -- http://mail.python.org/mailman/listinfo/python-list
The Strong Relationship between MatLab and MatPlotLib? What One Needs to Know?
Although MatPlotLib has plenty of examples, they do not seem to cover the fundamentals like figure. It seems as though in someway this is dependent upon a user's knowledge of MatLab. Is this true, or oes MatPlotLib provide some description of how forming a figure works? -- http://mail.python.org/mailman/listinfo/python-list
Object Not Callable, float?
Here's an traceback error msg I get. Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py, line 467, in ShowHistogram mean = sum(hist) TypeError: 'float' object is not callable for the code: -- sum = 0.0 avg = 0.0 nplt_bins = 32 for i in range(len(hist)): # msg = %5d %6d\n % (i,hist[i]) msg = %5d %6d\n % (i,hist[i]) sum = sum + hist[i] text.insert( END, msg ) for i in range(len(hist)): avg = avg + (i*hist[i]/sum) mean = sum(hist) -- faulty line mean = mean/256.0 -end hist is a list of 256 integers. What does float have to do with this? -- http://mail.python.org/mailman/listinfo/python-list
Re: Object Not Callable, float?
Ben Finney wrote: W. eWatson wolftra...@invalid.com writes: C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py, line 467, in ShowHistogram mean = sum(hist) TypeError: 'float' object is not callable It means you're calling an object of type ‘float’. The line where it occurred shows that you're accessing that object through the name ‘sum’, which means you've bound the name ‘sum’ to a float object. for the code: -- sum = 0.0 Here you clobber the existing binding of ‘sum’, binding it to the float value 0.0. avg = 0.0 nplt_bins = 32 for i in range(len(hist)): # msg = %5d %6d\n % (i,hist[i]) msg = %5d %6d\n % (i,hist[i]) sum = sum + hist[i] Here you keep re-binding the name ‘sum’ to new float objects of different value. text.insert( END, msg ) for i in range(len(hist)): avg = avg + (i*hist[i]/sum) mean = sum(hist) -- faulty line Here you try to call the object referenced by the name ‘sum’, which is a float object. hist is a list of 256 integers. What does float have to do with this? You explicitly bound the name ‘sum’ to an object of type ‘float’. Solution: Choose names wisely, and if you want to use a built-in name like ‘sum’ for its built-in putpose, don't clobber that binding before using it. Yikes. Thanks very much. Python seems to act unlike other language in which words like float are reserved. I'll use asum. -- http://mail.python.org/mailman/listinfo/python-list
Re: Object Not Callable, float?
John Bokma wrote: W. eWatson wolftra...@invalid.com wrote: Yikes. Thanks very much. Python seems to act unlike other language in which words like float are reserved. I'll use asum. The problem is that there is a function sum and you creating a float sum: sum = 0.0 and mean = sum(hist) even if both could exist side by side it would be very confusing IMO. John I think I understand it, but how does one prevent it from happening, or know it's the cause? That msg I got? I think PL/I, FORTRAN, ALGOL, etc. have reserved words. -- http://mail.python.org/mailman/listinfo/python-list
A More Concise Description of Numpy than the Guide to Numpy?
I'm looking the 300+ page pdf of the Guide to Numpy. Is there a more concise and practical guide to its use in science and mathematics? -- http://mail.python.org/mailman/listinfo/python-list
Re: A More Concise Description of Numpy than the Guide to Numpy?
Robert Kern wrote: On 2009-11-23 11:49 AM, W. eWatson wrote: I'm looking the 300+ page pdf of the Guide to Numpy. Is there a more concise and practical guide to its use in science and mathematics? You will want to ask numpy questions on the numpy mailing list: http://www.scipy.org/Mailing_Lists You may also find the NumPy User Guide more up your alley: http://docs.scipy.org/doc/numpy/user/ Thanks. I think I'll join the list, and the last link looks like a good alley. -- http://mail.python.org/mailman/listinfo/python-list
Re: Anyone with Experience Using WinTV Capture Cards?
Tim Roberts wrote: W. eWatson wolftra...@invalid.com wrote: W. eWatson wrote: A friend is looking for some help with how to use Python to access a WinTV (Go Plus) capture card, and how to display an image from it. Is there some facility that might help him, or does anyone have experience with such use that might suggest sources? Win XP OS. Any general methods for dealing with such commercially built capture cards? Let me Google that for you. http://www.lmgtfy.com?q=python+video+capture+windows Most such devices use DirectShow, so you need a C++ extension. He's headed down the c++ path now, and MSDN might be a better place to discover what can be done with Python and WinTV. A google there has proven fruitful, but my friend will have to determine how fruitful. I'm waiting for Hauppauge to respond to my request. His facilities do not allow him to get out to the internet. -- http://mail.python.org/mailman/listinfo/python-list
Anyone with Experience Using WinTV Capture Cards?
A friend is looking for some help with how to use Python to access a WinTV (Go Plus) capture card, and how to display an image from it. Is there some facility that might help him, or does anyone have experience with such use that might suggest sources? -- http://mail.python.org/mailman/listinfo/python-list
Re: Anyone with Experience Using WinTV Capture Cards?
W. eWatson wrote: A friend is looking for some help with how to use Python to access a WinTV (Go Plus) capture card, and how to display an image from it. Is there some facility that might help him, or does anyone have experience with such use that might suggest sources? Win XP OS. Any general methods for dealing with such commercially built capture cards? -- http://mail.python.org/mailman/listinfo/python-list
Adding the Copy Property to a Simple Histogram
The code below produces a text window 60hx20w with a scroll bar. The contents are something of a histogram of values from 0 to 255. If one tries to copy the contents, Windows doesn't allow it. What needs to be done to allow a copy and paste? def ShowHistogram(self): if not self.current_image: return if self.histogram: self.histogram.destroy() t = Toplevel( self.master ) t.title(Histogram) t.bind( 'Destroy', self.DestroyHistogram ) text = Text( t, height=60, width=20 ) scroll = Scrollbar(t, command=text.yview) text.configure(yscrollcommand=scroll.set) text.pack(side=LEFT, fill='both', expand=1) scroll.pack(side=RIGHT, fill=Y) self.histogram = t hist = self.current_image.histogram() for i in range(len(hist)): msg = %5d %6d\n % (i,hist[i]) text.insert( END, msg ) -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding the Copy Property to a Simple Histogram
Simon Forman wrote: On Jul 5, 9:48 pm, W. eWatson notval...@sbcglobal.net wrote: The code below produces a text window 60hx20w with a scroll bar. The contents are something of a histogram of values from 0 to 255. If one tries to copy the contents, Windows doesn't allow it. What needs to be done to allow a copy and paste? def ShowHistogram(self): if not self.current_image: return if self.histogram: self.histogram.destroy() t = Toplevel( self.master ) t.title(Histogram) t.bind( 'Destroy', self.DestroyHistogram ) text = Text( t, height=60, width=20 ) scroll = Scrollbar(t, command=text.yview) text.configure(yscrollcommand=scroll.set) text.pack(side=LEFT, fill='both', expand=1) scroll.pack(side=RIGHT, fill=Y) self.histogram = t hist = self.current_image.histogram() for i in range(len(hist)): msg = %5d %6d\n % (i,hist[i]) text.insert( END, msg ) -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ Do you mean that the Text widget doesn't let you copy-and-paste copy its contents using selection and Control-c? That shouldn't have anything to do with the contents of the Text widget. Whoops, I missed it. I'm not quite sure what I did to make it seem like it doesn't copy, but it does. I fooled myself. All is well. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Conventional Y Axis Label in pylab plot
I'd like to label the plot axes as x and y. All I see is xlabel and ylabel. ylabel puts y on its side, rotated 90 degrees from the horizontal. Is there way to put it in a normal reading (science/math) position? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: after_cancel?
Saul Spatz wrote: W. eWatson wrote: I'm looking a program that I'm not real familiar with that uses an after_cancel method and after_id variable. Are they related to some particular widget and what is there function? Perhaps they are related to a Cancel button on a widget? http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm Thanks. There was a chance it belonged to another part of the program the is processes an after event image. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: after_cancel?
Saul Spatz wrote: W. eWatson wrote: I'm looking a program that I'm not real familiar with that uses an after_cancel method and after_id variable. Are they related to some particular widget and what is there function? Perhaps they are related to a Cancel button on a widget? http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm Thanks. There was a chance it belonged to another part of the program the is processes an after event image. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
after_cancel?
I'm looking a program that I'm not real familiar with that uses an after_cancel method and after_id variable. Are they related to some particular widget and what is there function? Perhaps they are related to a Cancel button on a widget? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Writing a Raw Image to a File (Win, PIL)
I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing a Raw Image to a File (Win, PIL)
Diez B. Roggisch wrote: W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Did you bother reading the PIL documentation just for about 30seconds? http://www.pythonware.com/library/pil/handbook/image.htm Hint: look for save. Diez So, you are telling me what? To save it as a jpg file, or maybe a bmp file? All of them have headers, right? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing a Raw Image to a File (Win, PIL)
MRAB wrote: W. eWatson wrote: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Have you tried the .tostring() method? Perfect. Works exactly like I had hoped, 640x480 bytes--nothing more. Thanks. I had noticed it, but didn't get the connection. Then I wandered around nearby in the PIL description, and noticed something about decoding and write. Unknown territory to me. However, if I had followed up there was a connection between tostring and raw decoding. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Problem with PIL/Tkinter Program Example
Something is amiss here. The program produces a canvas in which one can move an object around. The input file is hard coded (see open). If you want to try it, you'll need to provide a file. Python error below. Name space difficulty? #Mouse movement from Tkinter import * import PIL import Image class data: startx=0 starty=0 def startmotioncallback(event): data.startx=event.x data.starty=event.y def motioncallback(event): deltax=event.x-data.startx deltay=event.y-data.starty data.startx=event.x data.starty=event.y # should put some limits on where the cirle is moved # left as exercise. data.cnv.move(data.ring,deltax,deltay) def Demo(root): # resize window root.geometry('400x400+0+0') data.root=root # make a canvas cnv=Canvas(root) cnv.pack(expand=1,fill=BOTH) data.cnv=cnv img=Image.open('jupa9810.jpg') # some image you have. raw_input(Hello) data.img=ImageTk.PhotoImage(img) data.photo=cnv.create_image(0,0,image=data.img,anchor='nw') data.ring=cnv.create_oval((100,100,300,300)) cnv.bind(B1-Motion,motioncallback) cnv.bind(Button-1,startmotioncallback) root.mainloop() Traceback (most recent call last): File C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py, line 45, in module Demo(root) File C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py, line 35, in Demo data.img=ImageTk.PhotoImage(img) NameError: global name 'ImageTk' is not defined -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with PIL/Tkinter Program Example
Peter Otten wrote: W. eWatson wrote: Something is amiss here. The program produces a canvas in which one can move an object around. The input file is hard coded (see open). If you want to try it, you'll need to provide a file. Python error below. Name space difficulty? Traceback (most recent call last): File C \Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py, line 45, in module Demo(root) File C \Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py, line 35, in Demo data.img=ImageTk.PhotoImage(img) NameError: global name 'ImageTk' is not defined If you want to use the ImageTk module you have to import it first: #Mouse movement from Tkinter import * import PIL import Image import ImageTk [rest of your code here] Peter Very good. Thanks. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
PIL\Tkinter and Transparencies, Rubber Lines, and Dragging Image Objects
Basically, I'd like to know how one (broadly, e.g., references in Win-land) does IP (image processing) and drawing techniques such as rubber lines, and dragging image objects across the canvas. I know there are some pretty powerful toolkits out there, but I'd like to limit this to PIL and Tkinter. If it can't be done with them, then I'll consider other possibilities. As a starter, on the topic of transparencies, consider this program that I pulled off the web and was posted in 1999. It purports to illustrate how one might produce a transparency. #!/usr/bin/python # see http://mail.python.org/pipermail/python-list/1999-May/003388.html from Tkinter import * import Image, ImageTk import tkFileDialog class Transparency: def __init__(self, parent): self.canvas = Canvas(parent, bg='green') self.canvas.pack() b = Button(parent, command=self.open, text=Select graphics file) b.pack() def open(self): self.canvas.delete(ALL) filename = tkFileDialog.askopenfilename() if filename != '': im = Image.open(filename) if im.mode != RGBA: im = Image.open(filename).convert(RGBA) source = im.split() R, G, B, A = 0, 1, 2, 3 mask = im.point(lambda i: i 0 and 255) # use black as transparent source[A].paste(mask) im = Image.merge(im.mode, source) # build a new multiband image self.graphic = ImageTk.PhotoImage(image=im) self.canvas.create_image(100, 100, image=self.graphic) if __name__ == __main__: root = Tk() test = Transparency(root) root.mainloop() It colors the canvas green, and produces a black background. An image is merged with the background. I tried out the program. It executes, but I do not see where the transparency is apparent. I used a gif with a picture of a telescope on a white background, and the result is what I would see if I pasted the telescope and white background onto the green canvas. If there's something missing in my observation, I'd like to know what it is. To further explore drawing graphics, what roughly is the capability of Tkinter or PIL to allow one to place a transparent layer (mode, I guess in PIL may be roughly equivalent to a layer in tools like Photoshop) on top of an image and then move the transparency around over the image with a mouse? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL\Tkinter and Transparencies, Rubber Lines, and Dragging Image Objects
You got it. That lamda did look a little odd. The white background is opaque and the telescope is seen as green. The program will ask for a file. I didn't write the code. Eric Brunel wrote: W. eWatson wrote: Basically, I'd like to know how one (broadly, e.g., references in Win-land) does IP (image processing) and drawing techniques such as rubber lines, and dragging image objects across the canvas. I know there are some pretty powerful toolkits out there, but I'd like to limit this to PIL and Tkinter. If it can't be done with them, then I'll consider other possibilities. As a starter, on the topic of transparencies, consider this program that I pulled off the web and was posted in 1999. It purports to illustrate how one might produce a transparency. OK, maybe I'm dumb but: #!/usr/bin/python # see http://mail.python.org/pipermail/python-list/1999-May/003388.html from Tkinter import * import Image, ImageTk ... HTH - Eric - -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
PIL Handbooks
I'm very new to PIL, and don't see any handbooks for 1.1.6 or the forthcoming 1.1.7. In fact, this looks like the extent of them: * Python Imaging Library Handbook for 1.1.5 (online) * Python Imaging Library Handbook for 1.1.3 (PDF) Somewhere in my recent search I see that 1.1.6 has some features like digital cameras and scanners. Ah here, http://pypi.python.org/pypi/PIL/1.1.6. Any other news? I'd settle even for a 1.1.5 pdf of the handbook right now. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL Handbooks
Irmen de Jong wrote: W. eWatson wrote: I'm very new to PIL, and don't see any handbooks for 1.1.6 or the forthcoming 1.1.7. In fact, this looks like the extent of them: * Python Imaging Library Handbook for 1.1.5 (online) * Python Imaging Library Handbook for 1.1.3 (PDF) Somewhere in my recent search I see that 1.1.6 has some features like digital cameras and scanners. Ah here, http://pypi.python.org/pypi/PIL/1.1.6. Any other news? I'd settle even for a 1.1.5 pdf of the handbook right now. Download the source package tarball , it contains the HTML documentation. --irmen In the Doc foler, I see a bunch of html files, but nothing about a handbook. It seems like the front sections are missing in that folder. Concepts, tutor, whatever. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Default Tkinter Structure of a 640x480 PIL BMP File?
See Subject. Does it have a header, DIB, palette, and data section? What is the default depth? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
W. eWatson wrote: W. eWatson wrote: It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? I'm now on the scipy mail list. Things look hopeful, according to the first respondent, to meet my criteria mentioned in another sub-thread to this one: I'm hoping the use of this library will be relative simple for my purposes, which are basically to write an image to a fits file with a somewhat simple header, which might include lat/long, date, image size, date-time, and a comment. Apparently, the first chapter or several pages or so of a manual distributed with PyFits is enough. The link I mentioned in another sub-thread here about the U of Wash. is http://www.astro.washington.edu/users/rowen/ -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
W. eWatson wrote: It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? I'm now on the scipy mail list. Things look hopeful, according to the first respondent, to meet my criteria mentioned in another sub-thread to this one: I'm hoping the use of this library will be relative simple for my purposes, which are basically to write an image to a fits file with a somewhat simple header, which might include lat/long, date, image size, date-time, and a comment. Apparently, the first chapter or several pages or so of a manual distributed with PyFits is enough. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
Michiel Overtoom wrote: W. eWatson wrote: It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? According to http://www.stsci.edu/resources/software_hardware/pyfits: PyFITS’s source code is pure Python. It requires Python version 2.3 or newer. PyFITS also requires the numarray module. PyFITS uses python’s distutils for its installation. To install it, unpack the tar file and type: python setup.py install It looks like PyFits is platform-independent. Greetings, That link gives me a Resource Not Found!, but does have info about STSci. I think this gets me back to their page with a tar file. I see tar comes up below, so I'll appear down there. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
John Yeung wrote: On Mar 28, 4:03 pm, Michiel Overtoom mot...@xs4all.nl wrote: W. eWatson wrote: It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? To install it, unpack the tar file and type: python setup.py install It looks like PyFits is platform-independent. Perhaps the original poster is referring to the tar file, which isn't natively supported by Windows and possibly isn't understood by WinZip either (not sure about that one). I recommend downloading and installing 7-Zip, which is free and handles more formats. It will let you extract the contents, which you can then install normally with the setup script as shown above. John Yes, I keep getting to a tar file with Google and just going to the STSci site. I use IZarc. Maybe it handles tar files. I'll give it a try. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
W. eWatson wrote: Michiel Overtoom wrote: W. eWatson wrote: It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? According to http://www.stsci.edu/resources/software_hardware/pyfits: PyFITS’s source code is pure Python. It requires Python version 2.3 or newer. PyFITS also requires the numarray module. PyFITS uses python’s distutils for its installation. To install it, unpack the tar file and type: python setup.py install It looks like PyFits is platform-independent. Greetings, That link gives me a Resource Not Found!, but does have info about STSci. I think this gets me back to their page with a tar file. I see tar comes up below, so I'll appear down there. I downloaded the tar file, and untarred it with IZarc. That's a strange way to package it, that is, for Windows. This almost suggests not many Win users are using it. One of the pages, http://www.scipy.org/wikis/topical_software/Tutorial, has a lot of tutorial material. It almost looks like overload on the subject. I'm hoping the use of this library will be relative simple for my purposes, which are basically to write an image to a fits file with a somewhat simple header, which might include lat/long, date, image size, date-time, and a comment. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFits for Windows?
andrew cooke wrote: W. eWatson wrote: I downloaded the tar file, and untarred it with IZarc. That's a strange way to package it, that is, for Windows. This almost suggests not many Win users are using it. One of the pages, http://www.scipy.org/wikis/topical_software/Tutorial, has a lot of tutorial material. It almost looks like overload on the subject. I'm hoping the use of this library will be relative simple for my purposes, which are basically to write an image to a fits file with a somewhat simple header, which might include lat/long, date, image size, date-time, and a comment. i have no idea what the current status is, but there used to be a python implementation of the iraf astronomy image processing system (iraf) called pyraf. if was developed by stsci, if i remember correctly. you might find that useful. it will certainly support manipulating fits files etc, but may be a bit heavweight for your needs. andrew Along these lines, there was an astronomy python site at the U of Washington not many months ago. The link is broken. Any idea where it went? I sent the astro dept a msg about it a few hours ago. NASA has one too, but it's not loading today. The govt. sites seem to have troubles on the weekend. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Grayson, Tkinter, Chapter 5
Fragments of Grayson's Python Tkinter are on the web at http://www.manning.com/grayson/. The site contains all the examples in the book. Chapter 5 is there as a pdf. In it he describes an image editor, p86f. I suspect only users of Grayson's book can answer these questions, but maybe reference to the site will do. (I may have answered my own question in the last few sentences.) The code pulls in 9, possibly 10, images to populate a grid. It looks like he's dealing 150x150 thumbnails. The overall grid contains 15 rows by 8 columns, which are broken into blocks of 5 rows by 2 columns. That is, there are 12 blocks, 3 rows by 4 columns. The imgfile seems to be missing for Chapter 7, but there are a number of individual image files in the Image folder for the chapter. Does any one have it or is it there? Why is he putting images in the blocks? That is, why did he need rows and columns within the blocks? Are these rows and columns in a block somehow 30 pixels on a side, so the block is 150x60, which looks about the size of the calculator images shown in figure 5.19? Perhaps the need for all the rows is the manner in which he needs the radio button, plain button, combo box, etc in the lower right corner. In fact, I suspect that's exactly it. Well, I just leave this open for comments anyway.It is a very instructive example on grids. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
PyFits for Windows?
It looks like PyFits downloads are for Linux. Isn't there anything available for Win (xp)? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Geometry package
Justin Pearson wrote: Hi all, I'm looking for a geometry package in Python; something that will let me define line segments, and can tell me if two line segments intersect. It would be nice if the lines could be defined in n-space (rather than be confined to 2 or 3 dimensions), but this is not a hard constraint. Other functionality might include support for polygons, convex hulls, etc. I've searched Pypi and found a package called Shapely, but when I followed its installation instructions, it threw a bunch of errors and tried to re-install Python :(. Is there a well-known geometry package I'm missing? Thanks for your help, Justin Somewhere book marked I have a reference on intersection determination. I need to reference it myself, and will look later. In the meantime, a Google search on robotics imaging line intersection might do the the trick. Now that I think about it, the article was aimed at finding the minimal distance between two lines in space. Anyway, the Google tip might get you started. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter book on current versions
Paul Watson wrote: Has anyone tried the Grayson book, Python and Tkinter Programming, with a recent version of Python? The first example code (calculator) generates a single row of buttons. Perhaps I have not applied the errata correctly. Has anyone been successful? I am using: Python 2.5.2 (r252:60911, Dec 1 2008, 17:47:46) If you mean calc1.py, I had no trouble with calc1.py under 2.5, but calc2.py uses Pmw, which I do not have. calc2 has a few problems with mixing tabs and blanks. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Tkinter--Column Alignment in a Dialog
The code below produces: Label title frame lat/long fields in a frame Label x,y label fields in a frame Standard OK-Cancel buttons How do I fix it so the lat/long left most field lines up with the x,y left most field? That is, I get something like: Lat: BOX Long: BOX pixel-x: BOX pixel-y: BOX I want the second line to be pushed to the left. BOX is just a data entry field. I want the two rows as far to the margin on the left. # testTk.py # Prototype for dialog from Tkinter import * from tkSimpleDialog import Dialog import tkSimpleDialog import tkMessageBox class DialogPrototype(Dialog): def body(self, master): # Titles fLocationTitle = Frame(master) # fL..., f for frame fLocationTitle.pack() # Frames fLocationTitle = Frame(master) fLocationTitle.pack() fCoords = Frame(master) fCoords.pack(side=TOP) beef=Entry(fCoords,width=20) fZenithTitle = Frame(master) fZenithTitle.pack(side=TOP) fZenith = Frame(master) fZenith.pack(side=TOP) self.title(Enter Site/Misc. Data) # Latitude and Longitude Label(fLocationTitle, text=Geographic Location).grid(row=0,column=0) Label(fCoords, text='Latitude:').grid(row=0, sticky=W+E, padx=5, pady=3) lat = Entry(fCoords, width=12) lat.grid(row=0, column=1) Label(fCoords, text='Longitude:').grid(row=0, column=2, padx=5, pady=3) long = Entry(fCoords, width=12) long.grid(row=0, column=3) # Zenith pixels Label(fZenithTitle, text=Zenith Pixel Position).grid(row=0,column=0, pady=4) Label(fZenith, text='Zenith x:').grid(row=0, column=0, padx=5, pady=3) zenith_x = Entry(fZenith, width=6) zenith_x.grid(row=0, column=1) Label(fZenith, text='Zenith y:').grid(row=0, column=2,padx=5,pady=3) zenith_y = Entry(fZenith, width=6) zenith_y.grid(row=0, column=3) return def apply(self): print apply print self.lat.get() print self.long.get() print setting lat=1.0 long=0.0 root = Tk() root.withdraw() DialogPrototype(root) -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
I happened to notice that BJ and Rhondi started a small subthread to this, so I thought I'd explore it. It led to interesting things, but not for its content. I reviewed some things. I'll do you the courtesy or wrapping this up. I'll get straight to the point and be a minimal as possible in my response, without accusing or implying anyone of anything. My guess is that the first culprit was here: entry = Entry(master, width=10, ... entry.insert(0,self.slowdown) --- no affect. The next culprit was this: self.anumberVar.set( %d % self.sdict[anumber] ) One must be very careful of what is in anumber. That's it. Nothing else. The changes I've made in the 2000 lines of code work, as I had intended. The sample code now works as I had intended. (And no, I am not providing it. This thread doesn't need more explanation.) I can now proceed to eliminate all the control variables. You'll have to be satisfied with what I've said. I have no more to say. All parts of this thread I consider closed. Include me out. -- Yogi Berra -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
Rhodri James wrote: On Tue, 10 Mar 2009 04:14:51 -, W. eWatson notval...@sbcglobal.net wrote: Marc 'BlackJack' Rintsch wrote: On Mon, 09 Mar 2009 04:22:57 -0700, W. eWatson wrote: Marc 'BlackJack' Rintsch wrote: On Sun, 08 Mar 2009 22:20:09 -0700, W. eWatson wrote: You didn't answer my question why entry is necessary at all. The original author thought it was necessary to return entry. I'll give you a peek at a segment of the code I'm working with here: class Enter_Data_Dialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): self.sdict = sdict tkSimpleDialog.Dialog.__init__(self, parent) def body(self,master): self.title(Set a Number Entry Dialog) Label( master, text=Number ).grid(row=0, sticky=W) self.anumberVar = StringVar() entry = Entry(master, width=10, textvariable=self.anumberVar).grid(row=0, column=1) self.anumberVar.set( %d % self.sdict[anumber] ) return entry `entry` is unnecessary here. But that was not obvious from your previous example, as you trimmed the code. Now it is clear that `entry` is always `None` because that's what `grid()` returns. But according to the docs this method should return the widget, that should get the focus, so maybe the author really wanted to return the `Entry` instance here, instead of `None`. He's got to return something, because he uses it upon return, as here: `entry` is always `None`, so it is the same as returning nothing because every function has an implicit ``return None`` at the end. def Set_Enter_Data(self): sdict = {} sdict[ ok ] = False sdict[ anumber ] = self.anumber dialog = Enter_Data_Dialog( self.master, sdict ) --- returning That's not a call to the `body()` method so that ``return`` is irrelevant here. Here an instance of `Enter_Data_Dialog` is created. No ``return`` involved. BTW if this is really just a dialog to enter a number, the functions `askinteger()` or `askfloat()` from the `tkSimpleDialog` module can be used. Ciao, Marc 'BlackJack' Rintsch What you are seeing here as an example, is a paired down version of the 2000 line program to focus on the particular problem at hand. The full code uses up to 20 variable of various types, via the dialog object. It uses them successfully to get the values the user has entered. How can it be irrelevant if it works? The author thought this was the way to do it. It's not my invention. It's no fluke. He does the same thing in another dialog that brings back about 6 values. def body(self,master): [snip] You're misunderstanding. The line that you arrowed above has absolutely nothing whatsoever to do with the method body(), so keeping on showing us ever fuller version of that isn't going to prove anything. Now if you were to show us a line like something = dialog.body(something_else) then you might be onto something, but personally I suspect you're going to find that rather hard. I'd be happy to comply. Perhaps I'm mistaken as what I was responding to in the entanglement of responses, but I think I was making a point (again) that the technique by the author works. This should clear matters up completely. Here's the full 80+ lines of the example code. Note wrapped lines. from Tkinter import * import tkSimpleDialog import tkMessageBox class IntVar_GUI: def __init__(self, master): master.title('Control Variable Fun') self.frame = Frame(master,takefocus=1, highlightthickness=2, highlightcolor='blue') self.frame.configure(height=200,width=200) self.frame.pack() #self.frame.bind(KeyPress, self.HandleKey) self.anumber = 123 # Want name and value to be configurable self.master = master menu = Menu(master) master.config(menu=menu) self.mainMenu = Menu(menu) menu.add_cascade(label=My Menu,menu=self.mainMenu) self.mainMenu.add_command(label=Enter Data, command=self.Set_Enter_Data) self.mainMenu.add_command(label=Exit,underline=1,command=self.Quit) self.Focus() def Set_Enter_Data(self): sdict = {} sdict[ ok ] = False sdict[ anumber ] = self.anumber dialog = Enter_Data_Dialog( self.master, sdict ) self.Focus() print Howdy, set data. Number is:, dialog.anumberVar.get() print dict:, dialog.sdict if not dialog.sdict[ok]: return try: self.anumber = int(eval(dialog.anumberVar.get())) print OK except: print Not OK pass print self.anumber:, self.anumber def Quit(self): self.running = False #self.master.quit() self.master.destroy() def Focus( self ): self.frame.focus_set() class Enter_Data_Dialog
Re: A Dangling Tk Entry
Down, Fang! Down, boy. Down. -- Soupy Sales, Comedian, talking to his imaginary animal, circa 1960. Thank you very much. One more quote before I continue. A favorite. The trouble with most folks isn't their ignorance. It's knowin' so many things that ain't so. by Josh Billings, a 19th century humorist (and not Mark Twain). I could quote my wife next, but I'll skip it. As I believe I've repeatedly said, (aren't those interesting words? Sort of sound huffy, don't they?), I am not the author of the code. If I didn't mention it before, I am not about to wholesale change his code for the purposes I have at hand, so I try to remain faithful to what was written. As far as taking your grid suggestions, I believe I did, very likely in the 2000 lines of father code (the author's original code.) For whatever reason, they didn't work. Yes, even I am as a lowly newcomer to Python and Tkinter have heard the eval story. Again, I do not want diversions while I'm adding to this program. Just to be clear about what I'm adding, the program needed, IMHO, a configuration file. I've already added a menu item in other parts of the code to save it, and to initialize the 'global' values the author uses in IntVar_GUI. That's the alias here for Sentinel_GUI in the big program. Now I can proceed to initialize the dialog and others without using control variables. This config effort I could have skipped, but thought it's now or never. I have things to add to the program that are way more interesting than this, and will have big payoffs to the users (a closed group of about 40 users). Despite my no messing with code technique policy, I may have to take into consideration some of your changes here, and your follow up. And, yes, I think I can now begin to tune up my geometry knowledge of Tkinter. So again, thanks for your help. (I hope you don't mind my repetition here.) :-) r wrote: OK, here is a slightly cleaned up version of this horrible code. I did not change too much at one time for fear of confusing you. The main problem is you did not explicitly grid the entry like i told you earlier, and why you are using eval is beyond any measure of sanity... from Tkinter import * import tkSimpleDialog class IntVar_GUI: def __init__(self, master): self.master = master master.title('Control Variable Fun') self.frame = Frame(master, height=200, width=200, takefocus=1, highlightthickness=2, highlightcolor='blue') self.frame.pack() #self.frame.bind(KeyPress, self.HandleKey) self.anumber = 123 # Want name and value to be configurable menu = Menu(master) master.config(menu=menu) self.mainMenu = Menu(menu) menu.add_cascade(label=My Menu,menu=self.mainMenu) self.mainMenu.add_command(label=Enter Data, command=self.Set_Enter_Data) self.mainMenu.add_command (label=Exit,underline=1,command=self.Quit) self.Focus() def Set_Enter_Data(self): sdict = {ok:False, anumber:self.anumber} dialog = Enter_Data_Dialog(self.master, sdict) self.Focus() print Howdy, set data. Number is:, dialog.anumberVar.get() print dict:, dialog.sdict if not dialog.sdict[ok]: return try: self.anumber = int(dialog.anumberVar.get())#why the heck where you using eval here? print OK except: print Not OK pass print self.anumber:, self.anumber def Quit(self): self.running = False #self.master.quit() self.master.destroy() def Focus( self ): self.frame.focus_set() class Enter_Data_Dialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): self.sdict = sdict tkSimpleDialog.Dialog.__init__(self, parent) def body(self,master): self.title(Set a Number Entry Dialog) Label( master, text=Number ).grid(row=0, sticky=W) self.anumberVar = StringVar() entry = Entry(master, width=10, textvariable=self.anumberVar) entry.grid(row=0, column=1) #i told you to explicitly grid a widget you want to call later entry.insert(0,11) self.anumberVar.set( %d % self.sdict[anumber] ) return entry def apply(self): self.sdict[ok] = True def Process(): root = Tk() app = IntVar_GUI(root) root.mainloop() if __name__ == __main__: Process() The next message i send will be a rewrite of this code in a proper Pythonic fashion, this frankly is a plate of spaghetti! -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
r wrote: On Mar 10, 10:52 am, W. eWatson notval...@sbcglobal.net wrote: [snip: biting the hand that feeds] This is not the first time you have come to c.l.py with hat in hand seeking help and then scoffed at suggestions made by well respected posters. I should have known you would just do the same again. I don't know what you want but help is defiantly not it although that is exactly what you need! If I didn't mention it before, I am not about to wholesale change his code for the purposes I have at hand, so I try to remain faithful to what was written. As far as taking your grid suggestions, I believe I did, very likely in the 2000 lines of father code (the author's original code.) For whatever reason, they didn't work. Yes, even I am as a lowly newcomer to Python and Tkinter have heard the eval story. Again, I do not want diversions while I'm adding to this program. [snip: non-sensical rambling] You think my changes where wholesale. I untangled your spaghetti code and showed you how it should be done with the same output you originally had(while at the same time trying hard not to confuse you by making the code too perfect), only unlike your mess, my code doesn't throw 10 exceptions. There is nothing in there that will break compatibility with your code, heck you said it was broken to start. Just to be clear about what I'm adding, the program needed, IMHO, a configuration file. I've already added a menu item in other parts of the code to save it, and to initialize the 'global' values the author uses in IntVar_GUI. That's the alias here for Sentinel_GUI in the big program. Now I can proceed to initialize the dialog and others without using control variables. This config effort I could have skipped, but thought it's now or never. I have things to add to the program that are way more interesting than this, and will have big payoffs to the users (a closed group of about 40 users). If this 80 line code you posted actually is a line by line copy paste from your suposedly high and mighty original author's code, you would be much better off trashing this garbage and starting from scratch, because apparently he had no idea what he was doing either. Using naming conventions like IntVar_GUI instead of IntVarGui, and Enter_Data_Dialog instead of EnterDataDialog . Not to mention this redundant stupidity sdict = {} sdict[ ok ] = False sdict[ anumber ] = self.anumber Only a complete noob would do something like that! Not to mention that he created a Focus method that calls one line of code. This is a classic case of the blind leading the blind. good day pal... and oh yea, good luck! Pardon me, it was White Fang. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
Marc 'BlackJack' Rintsch wrote: On Sun, 08 Mar 2009 22:20:09 -0700, W. eWatson wrote: You didn't answer my question why entry is necessary at all. The original author thought it was necessary to return entry. I'll give you a peek at a segment of the code I'm working with here: class Enter_Data_Dialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): self.sdict = sdict tkSimpleDialog.Dialog.__init__(self, parent) def body(self,master): self.title(Set a Number Entry Dialog) Label( master, text=Number ).grid(row=0, sticky=W) self.anumberVar = StringVar() entry = Entry(master, width=10, textvariable=self.anumberVar).grid(row=0, column=1) self.anumberVar.set( %d % self.sdict[anumber] ) return entry `entry` is unnecessary here. But that was not obvious from your previous example, as you trimmed the code. Now it is clear that `entry` is always `None` because that's what `grid()` returns. But according to the docs this method should return the widget, that should get the focus, so maybe the author really wanted to return the `Entry` instance here, instead of `None`. Ciao, Marc 'BlackJack' Rintsch He's got to return something, because he uses it upon return, as here: def Set_Enter_Data(self): sdict = {} sdict[ ok ] = False sdict[ anumber ] = self.anumber dialog = Enter_Data_Dialog( self.master, sdict ) --- returning self.Focus() print Howdy, set data. Number is:, dialog.anumberVar.get() print dict:, dialog.sdict if not dialog.sdict[ok]: return try: self.anumber = int(eval(dialog.anumberVar.get())) print OK except: print Not OK pass print self.anumber:, self.anumber -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
Marc 'BlackJack' Rintsch wrote: On Mon, 09 Mar 2009 04:22:57 -0700, W. eWatson wrote: Marc 'BlackJack' Rintsch wrote: On Sun, 08 Mar 2009 22:20:09 -0700, W. eWatson wrote: You didn't answer my question why entry is necessary at all. The original author thought it was necessary to return entry. I'll give you a peek at a segment of the code I'm working with here: class Enter_Data_Dialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): self.sdict = sdict tkSimpleDialog.Dialog.__init__(self, parent) def body(self,master): self.title(Set a Number Entry Dialog) Label( master, text=Number ).grid(row=0, sticky=W) self.anumberVar = StringVar() entry = Entry(master, width=10, textvariable=self.anumberVar).grid(row=0, column=1) self.anumberVar.set( %d % self.sdict[anumber] ) return entry `entry` is unnecessary here. But that was not obvious from your previous example, as you trimmed the code. Now it is clear that `entry` is always `None` because that's what `grid()` returns. But according to the docs this method should return the widget, that should get the focus, so maybe the author really wanted to return the `Entry` instance here, instead of `None`. He's got to return something, because he uses it upon return, as here: `entry` is always `None`, so it is the same as returning nothing because every function has an implicit ``return None`` at the end. def Set_Enter_Data(self): sdict = {} sdict[ ok ] = False sdict[ anumber ] = self.anumber dialog = Enter_Data_Dialog( self.master, sdict ) --- returning That's not a call to the `body()` method so that ``return`` is irrelevant here. Here an instance of `Enter_Data_Dialog` is created. No ``return`` involved. BTW if this is really just a dialog to enter a number, the functions `askinteger()` or `askfloat()` from the `tkSimpleDialog` module can be used. Ciao, Marc 'BlackJack' Rintsch What you are seeing here as an example, is a paired down version of the 2000 line program to focus on the particular problem at hand. The full code uses up to 20 variable of various types, via the dialog object. It uses them successfully to get the values the user has entered. How can it be irrelevant if it works? The author thought this was the way to do it. It's not my invention. It's no fluke. He does the same thing in another dialog that brings back about 6 values. def body(self,master): self.title(Box Settings) print body from BSD ... frame_delay = Entry( master, textvariable=self.frame_delay_var, width=10 ).grid( row=2, column=1, sticky=W ) ... Entry( master, textvariable=self.untrigger_threshold_var, width=10 ).grid( row=4, column=1, sticky=W ) self.untrigger_threshold_var.set( %d % self.sdict[untrigger_threshold] ) return frame_delay BTW, forget the textvariable use. They are irrelevant. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
A Dangling Tk Entry
I'm looking at some Tk code written by someone else, and am curious about a methodology in the code. A setup object called SetDlg contains to code to set up parameters for some widgets for a dialog of radio buttons, checkboxes, and text/string entries. It then calls ShowDlg. After it returns in resets any new values entered for parameters. It's return is entry, which is of class Entry. The curious code is in ShowDlg. It looks like Radiboutton(master, textvariable = ... Radiobutton(msster, textvariable = ... Checkbox(master, text=... entry = Entry(master, width=10, ... entry.insert(0,self.slowdown)# testing a default methodology Label( master, text=Max... Entry(master, width=10, textvar... ... return entry First, what is the meaning of entry=Entry(...? That is, other than create an Entry, why that particular position, and why not with say Checkbox? Further, SetDlg has used ShowDlg by calling dialog=ShowDlg(( self.master, set_a... dialog is then used to get at the parameters set by the user. I thought I'd give ShowDlg an attribute by using entry.insert(0,self.slowdown inserting it before return. Upon return from ShowDlg, which was invoked by, dialog = ShowDlg( self.master, set_a ..., I thought I'd grab slowdown with x= dialog.slowdown. The program didn't get that far, so, second, I'd like to know why it died on the insert statement? That line, produced 'NoneType' object has no attribute 'insert' , and entry and its type are None and type 'NoneType' What has gone wrong? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Dangling Tk Entry
r wrote: On Mar 8, 9:34 pm, W. eWatson notval...@sbcglobal.net wrote: Radiboutton(master, textvariable = ... Radiobutton(msster, textvariable = ... Checkbox(master, text=... entry = Entry(master, width=10, ... entry.insert(0,self.slowdown)# testing a default methodology Label( master, text=Max... Entry(master, width=10, textvar... ... return entry First, what is the meaning of entry=Entry(...? That is, other than create an Entry, why that particular position, and why not with say Checkbox? It sounds like you don't understands some fundamentals of Tkinter programming. You only need to create a reference(instance) to a tk widget if you plan to access it later. Widgets like labels (in some cases) will never change, so creating an instance is just furturing your capal tunnel avancment. :). Checkbuttons and Radiobuttons use Variables to query thr widget so they also do not need to be instanced Something else that you need to understand, You must explicitly pack (), place(), or grid() a widget instance if you wish to call that instance later or you will get an error. #-- this no work --# entry = Entry(master).pack() #cannot call entry.method() #-- this works --# entry = Entry(master) entry.pack() Further, SetDlg has used ShowDlg by calling dialog=ShowDlg(( self.master, set_a... dialog is then used to get at the parameters set by the user. I thought I'd give ShowDlg an attribute by using entry.insert(0,self.slowdown inserting it before return. Upon return from ShowDlg, which was invoked by, dialog = ShowDlg( self.master, set_a ..., I thought I'd grab slowdown with x= dialog.slowdown. The program didn't get that far, so, second, I'd like to know why it died on the insert statement? That line, produced 'NoneType' object has no attribute 'insert' , and entry and its type are None and type 'NoneType' What has gone wrong? I would suspect a geometry manager issue here but you really should post all the code for this dialog. Guilty as charged, somewhat. I'm modifying someone else's code to provide new features, and have modest understanding of how Tk works. However, the reason for making them an instance is not unreasonable at all. This should work. I really don't think the geometry mgr has anything to do with it. If there's an early miscue here on my part, it's about using insert. My understanding is that insert will allow me put something into the entry area shown in the widget on the screen. That is if, I put up: Enter Data Here: __, the _ represents the entry widget created. What I'm trying to do is initialeze it with, say, 1234. You didn't answer my question why entry is necessary at all. The original author thought it was necessary to return entry. I'll give you a peek at a segment of the code I'm working with here: class Enter_Data_Dialog(tkSimpleDialog.Dialog): def __init__(self, parent, sdict): self.sdict = sdict tkSimpleDialog.Dialog.__init__(self, parent) def body(self,master): self.title(Set a Number Entry Dialog) Label( master, text=Number ).grid(row=0, sticky=W) self.anumberVar = StringVar() entry = Entry(master, width=10, textvariable=self.anumberVar).grid(row=0, column=1) self.anumberVar.set( %d % self.sdict[anumber] ) return entry This code works. What I'm trying to do is to eliminate the unnecessary use of control variables. As it, stands the calling program sets up the default value for anumber and returns whatever new value enters. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Simple Tkinter Control Program--Slight Problem
I like to see closure on a thread. This should do it. from Tkinter import * # Use of control variables and callbacks def mycallback(): print User entered: , e.get() print Operation by 2 gives: , e.get()*2, and, v.get()*2 master = Tk() #v=StringVar() v=IntVar() print v,type(v) print v, type(v), type(v.get()) e = Entry(master,textvariable=v) e.pack() b = Button(master, text=Push to Print, width=10, command=mycallback) b.pack() e.focus_set() v.set(123) mainloop() -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration Files and Tkinter--Possible?
Gabriel Genellina wrote: En Wed, 04 Mar 2009 03:13:43 -0200, W. eWatson notval...@sbcglobal.net escribió: I'm converting a Tkinter program (Win XP) that uses widgets that allows the user to change default values of various parameters like start and stop time in hh:mm:ss, time of exposure in seconds, and whether certain options should be on or off. The initial values are ... don't have to track changes to the variables (by example, a zoom slider might provide feedback by zooming the image). So in the Options... menu item in your application, you: - create the dialog with the required widgets. - call a method .setvalues(config) which receives a config object with all the settings, and assigns them to each corresponding widget. - have a method .getvalues(config) that does the inverse operation: from widget contents into the config object. - display the dialog (you must use a modal loop; see http://effbot.org/tkinterbook/tkinter-dialog-windows.htm ). If you use tkSimpleDialog, make sure the .apply() method calls .getvalues - on exit, the config object contains the final values. That's fine, but I think my problem boils down to one question. There seem to be two ways to communicate with a dialog (I mean a collection of widgets assembled in a window that requires the user enter various parameters, integers, strings, yes/no button, etc.): 1. a callback and 2. control variables. Which one should be used? To be more explicit, look at this code from your source above http://effbot.org/tkinterbook/entry.htm. (This is about the simplest dialog one can have.) : ==start from Tkinter import * master = Tk() e = Entry(master) e.pack() e.focus_set() def callback(): print e.get() b = Button(master, text=get, width=10, command=callback) b.pack() mainloop() ===end Note that above this example, the author mentions: You can also bind the entry widget to a StringVar instance, and set or get the entry text via that variable: v = StringVar() e = Entry(master, textvariable=v) e.pack() v.set(a default value) s = v.get() Why have two ways of doing this? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration Files and Tkinter--Possible?
Gabriel Genellina wrote: En Wed, 04 Mar 2009 12:12:50 -0200, W. eWatson notval...@sbcglobal.net escribió: That's fine, but I think my problem boils down to one question. There seem to be two ways to communicate with a dialog (I mean a collection of widgets assembled in a window that requires the user enter various parameters, integers, strings, yes/no button, etc.): 1. a callback and 2. control variables. Which one should be used? The simplest way that probably works. The one you feel most comfortable with. The one best fits your application. There is no single answer. To be more explicit, look at this code from your source above http://effbot.org/tkinterbook/entry.htm. (This is about the simplest dialog one can have.) : [...code...] Note that above this example, the author mentions: You can also bind the entry widget to a StringVar instance, and set or get the entry text via that variable: Why have two ways of doing this? You may have some related widgets, and want to keep them syncronized. By example, a slider 0-100 and a text entry for some percentage. Moving the slider changes the number displayed, and editing the number moves the slider accordingly. There are other ways of doing the same: you may react to some events in one widget, and alter the other accordingly. But: - that requires that you know *which* events actually modify the value - increases coupling between all your widgets (consider what happens when you want to add an image showing the effect of moving the slider) So, in some cases, it is more convenient to use bound variables. You may consider this as a micro-application of the Model-View-Controller pattern. That said, I seldom use bound variables (but I seldom write GUIs using Tkinter either). Thanks, unfortunately I have no choice. I'm modifying a program that uses Tkinter, and so not to take on extra work, I need to stick with Tkinter. The author, for some reason, found it useful to use control variables. In trying to add a configuration file to the code, the control variables make it difficult. I have already coded the config file reading, writing, and setting of variables (setattr came in very handy to get the fixed code out of the way). However, to set them in the main dialog, is not easy, because it uses code like self.colorVar = IntVar() and dialog.colorVar.get(). To get rid of this written (hard) code, I have to manufacture it somehow by forming it from the names found in the config file, e.g., color=1. I'm aware of eval and exec, but wary of their use. It seems like the solution to all this is not to use control variables, if possible. Presently, I have no idea whether it is absolutely needed for the program. From what I can see on the web, and the few texts I have had access to, no one makes a clear distinction between the two choices by way of words or examples. This comes close: From Tkinter reference: a GUI for Python One special quality of a control variable is that it can be shared by a number of different widgets, and the control variable can remember all the widgets that are currently sharing it. This means, in particular, that if your program stores a value v into a control variable c with its c.set(v) method, any widgets that are linked to that control variable are automatically updated on the screen. I'm just getting into Tkinter, so that doesn't quite do it for me. I originally mentioned, ... it seems as though someone should have had a similar problem in the past. What I meant was implementing a config file arrangement with Tkinter. I was suggesting this seems nearly, if not, impossible with control variables, so there must be another way. I think the other way is described in the example I provided. Well, I think it's now time to go back to the code, and see what I can do to get rid of the control variables. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
A Simple Tkinter Control Program--Slight Problem
Here's what I think the author meant in discussing a control variable sample program. http://effbot.org/tkinterbook/entry.htm from Tkinter import * v=Tk.StringVar() e = Entry(master, textvariable=v) e.pack() e.focus_set() v.set(a default value) s = v.get() mainloop() The problem is that Python objects to v=. v=Tk.StringVar() AttributeError: class Tk has no attribute 'StringVar' What corrects this? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Simple Tkinter Control Program--Slight Problem
Marc 'BlackJack' Rintsch wrote: On Wed, 04 Mar 2009 10:09:10 -0800, W. eWatson wrote: Here's what I think the author meant in discussing a control variable sample program. http://effbot.org/tkinterbook/entry.htm from Tkinter import * v=Tk.StringVar() e = Entry(master, textvariable=v) e.pack() e.focus_set() v.set(a default value) s = v.get() mainloop() The problem is that Python objects to v=. v=Tk.StringVar() AttributeError: class Tk has no attribute 'StringVar' What corrects this? Learn how to copy code 1:1 from a web page or understand Python's import and namespaces. Ciao, Marc 'BlackJack' Rintsch It wasn't a matter of copying. I had experimented with the code and found a note that suggested using Tk, and another way of getting the job. It didn't work. I missed removing it (Tk). Never assume!--Spencer Tracy, cautioning Katharine Hepburn in a puzzle he is about to give her in the movie Desk Set. Here's the segment the author singled out: v = StringVar() e = Entry(master, textvariable=v) e.pack() v.set(a default value) s = v.get() -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for a General Method to Configure Tkinter Widgets
odeits wrote: On Mar 2, 7:14 am, W. eWatson notval...@sbcglobal.net wrote: I'm modifying a Tkinter Python program that uses hard coded initial values for several widgets. For example, latitude = 40. My plan is to put the names and values for configuration purposes into a file. For example, a pseudo statement like the one just given. ConfigObj provides a mechanism for it. I am only at an early stage of learning Tkinter, but it looks like a hang up is in the use of control variables passed between widgets and non-Tkinter objects that setup up the widget and retrieve the changed values. Roughly, the main loop contains code like self.longitude = 40. Non-Tkinter objects set up the parameters to the widgets, and when a widget* is complete the setup program resets the main loop globals. As I see it, it looks like IntVar, etc. used must be hard coded, as in the original program, to preserve types like boolean, strings, integers, floats, etc. It's either that or use of eval or some like function. Comments? * For example, in one setup program, I see code like this after its call to a dialog returns: try: s = dialog.stopVar.get() d = [ int(x) for x in s.split(:) ] self.stop_time = datetime.time(d[0],d[1],d[2]) stop_time is a string like 10:30:15. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ I am sorry, I am a bit confused. Is your question how to preserve the value and/or type of the data in the config file? Or are you having trouble getting the values from the file to the widget? I'm probably confused too. :-) Let's try this. In s=dialog.stopVar.get() I'd like to eliminate the statement and replace it with something like: s=dialog. + stopV.get() )and execute that--I'm aware of the exec operation--problems) where StopV is a string name taken from the config file. That is, in the config file there would be something like: stop_time = 18:00:00, stopV. Initially, when starting the program, reading that line would create a self.stop_time variable with the value 18:00:00 (string). To communicate with the dialog widget where the user enters a new value, I need to use control variables. but ones that are not in the code itself. Instead, I would like to manufacture them from what I see in the config file. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
A Simple Menu , Stretching the Window Width--Tkinter
I'd like to create a simple Menu bar with one item in it, say, called My Menu, and have a few submenu items on it like Change Data and Exit. I can do that but I'd like the title I put on the enclosing window to be completely visible. The title is, for example, Hello, out there. This is a simple menu. Presently the window shrinks in width the accommodate My Menu, and I see Hello, out th. How do I force the width to accommodate the whole title? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for a General Method to Configure Tkinter Widgets
W. eWatson wrote: odeits wrote: On Mar 2, 7:14 am, W. eWatson notval...@sbcglobal.net wrote: I'm modifying a Tkinter Python program that uses hard coded initial values for several widgets. For example, latitude = 40. My plan is to put the names and values for configuration purposes into a file. For example, a pseudo statement like the one just given. ConfigObj provides a mechanism for it. I am only at an early stage of learning Tkinter, but it looks like a hang up is in the use of control variables passed between widgets and non-Tkinter objects that setup up the widget and retrieve the changed values. Roughly, the main loop contains code like self.longitude = 40. Non-Tkinter objects set up the parameters to the widgets, and when a widget* is complete the setup program resets the main loop globals. As I see it, it looks like IntVar, etc. used must be hard coded, as in the original program, to preserve types like boolean, strings, integers, floats, etc. It's either that or use of eval or some like function. Comments? * For example, in one setup program, I see code like this after its call to a dialog returns: try: s = dialog.stopVar.get() d = [ int(x) for x in s.split(:) ] self.stop_time = datetime.time(d[0],d[1],d[2]) stop_time is a string like 10:30:15. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ I am sorry, I am a bit confused. Is your question how to preserve the value and/or type of the data in the config file? Or are you having trouble getting the values from the file to the widget? I'm probably confused too. :-) Let's try this. In s=dialog.stopVar.get() I'd like to eliminate the statement and replace it with something like: s=dialog. + stopV.get() )and execute that--I'm aware of the exec operation--problems) where StopV is a string name taken from the config file. That is, in the config file there would be something like: stop_time = 18:00:00, stopV. Initially, when starting the program, reading that line would create a self.stop_time variable with the value 18:00:00 (string). To communicate with the dialog widget where the user enters a new value, I need to use control variables. but ones that are not in the code itself. Instead, I would like to manufacture them from what I see in the config file. I've been told that there may be another way to communicate with Tkinter than control variables. I'm not quite sure what, but will probably know tomorrow. I think I will discontinue this thread, and re-post if necessary. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A Simple Menu , Stretching the Window Width--Tkinter
John Posner wrote: I'd like to create a simple Menu bar with one item in it, say, called My Menu, and have a few submenu items on it like Change Data and Exit. I can do that but I'd like the title I put on the enclosing window to be completely visible. The title is, for example, Hello, out there. This is a simple menu. Presently the window shrinks in width the accommodate My Menu, and I see Hello, out th. How do I force the width to accommodate the whole title? If you're having trouble with the size of the overall (root or toplevel) window, this might help: rootwin = Tk() # width=500, height=350, upper-left-corner at (50,50) -- revise to suit rootwin.geometry('500x350+50+50') rootwin.resizable(False, False) rootwin.title(Hello, out there) -John E-mail message checked by Spyware Doctor (6.0.0.386) Database version: 5.11880 http://www.pctools.com/en/spyware-doctor-antivirus/ Yep, that works. Thanks. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Configuration Files and Tkinter--Possible?
I'm converting a Tkinter program (Win XP) that uses widgets that allows the user to change default values of various parameters like start and stop time in hh:mm:ss, time of exposure in seconds, and whether certain options should be on or off. The initial values are set in the code. I can pretty well modify matters, so the values of parameters can be saved and restored from a config file for use outside the widgets (dialogs). Basically, a list of parameter names and values are kept in the file. However, it is a tricky job to set up values for a widget that allows the current values to appear in a dialog, and then return them to internal storage for use elsewhere. The problem is in trying to make control variable dynamic instead of as fixed code. There may be a solution, but it seems as though someone should have had a similar problem in the past. Is Python or Tkinter capable of solving this problem in some fashion? It may be that there's another way to set and return values to the widget. However, there seems to be an implication one can only do this with Tkinter control variables? Another way of saying this is is why are control variables needed anyway? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Looking for a General Method to Configure Tkinter Widgets
I'm modifying a Tkinter Python program that uses hard coded initial values for several widgets. For example, latitude = 40. My plan is to put the names and values for configuration purposes into a file. For example, a pseudo statement like the one just given. ConfigObj provides a mechanism for it. I am only at an early stage of learning Tkinter, but it looks like a hang up is in the use of control variables passed between widgets and non-Tkinter objects that setup up the widget and retrieve the changed values. Roughly, the main loop contains code like self.longitude = 40. Non-Tkinter objects set up the parameters to the widgets, and when a widget* is complete the setup program resets the main loop globals. As I see it, it looks like IntVar, etc. used must be hard coded, as in the original program, to preserve types like boolean, strings, integers, floats, etc. It's either that or use of eval or some like function. Comments? * For example, in one setup program, I see code like this after its call to a dialog returns: try: s = dialog.stopVar.get() d = [ int(x) for x in s.split(:) ] self.stop_time = datetime.time(d[0],d[1],d[2]) stop_time is a string like 10:30:15. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
Matimus wrote: On Feb 19, 8:06 pm, W. eWatson notval...@sbcglobal.net wrote: I'm using IDLE for editing, but execute programs directly. If there are execution or compile errors, the console closes before I can see what it contains. How do I prevent that? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ Open a console window and type in the name of the script rather than just double clicking on it. Or, you can terminate your script with a 'raw_input(press enter to quit)'. Matt I can open the Python command line from Start, but how do I navigate to the folder where the program is? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2.3 as the book is about to go to press, 2004. I thought IDLE came bundled with Python. I have Py 2.5. 1.2.2??? Puzzled. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson notval...@sbcglobal.net escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2.3 as the book is about to go to press, 2004. I thought IDLE came bundled with Python. I have Py 2.5. 1.2.2??? Puzzled. IDLE is a separate product; the version of IDLE that comes with Python 2.5.4 is 1.2.4 Where do I get 2.x.x, or the latest? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
Catherine Heathcote wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. you need to open a dos prompt before doing the steps above. Go to start-run and hit cmd enter without the quotes. Something is amiss here. There's the MS Command Prompt, which I'm looking at right now. Yes, it has cd, and so on. I'm also looking at the Python command line window. It allow one to run interactively. If I write a simple python program with just raw_input, by clicking on the file name, I get a window with the the title \Python25\pythonexe that shows the prompt. If I deliberately put a syntax error in the program, and run it by clicking the file, then A window appears and disappears so quickly that I have no idea what it said. How do I keep that window up? Which, if any, of these is the real Python console? What is the window called in the example I gave with raw_input? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
Catherine Heathcote wrote: W. eWatson wrote: Catherine Heathcote wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. you need to open a dos prompt before doing the steps above. Go to start-run and hit cmd enter without the quotes. Something is amiss here. There's the MS Command Prompt, which I'm looking at right now. Yes, it has cd, and so on. I'm also looking at the Python command line window. It allow one to run interactively. If I write a simple python program with just raw_input, by clicking on the file name, I get a window with the the title \Python25\pythonexe that shows the prompt. If I deliberately put a syntax error in the program, and run it by clicking the file, then A window appears and disappears so quickly that I have no idea what it said. How do I keep that window up? Which, if any, of these is the real Python console? What is the window called in the example I gave with raw_input? Run the program from within the MS command line, not by double clicking it. Shirley, you jest? DOS? To do this? How ugly. I barely recall the DOS commands. I get to drill my way down 4 levels of folders. What DOS cmd allows one to list only folders? Still, why would one design a window that disappears, when it has useful data in it? I see that if I click on the window, it has properties, width, height, etc. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:29:35 -0200, W. eWatson notval...@sbcglobal.net escribió: Gabriel Genellina wrote: En Fri, 20 Feb 2009 12:05:08 -0200, W. eWatson notval...@sbcglobal.net escribió: Whoa! What's going on here? I just looked at About IDLE, and it shows 1.2.2, but yet the second edition of Learning Python talks about going to 2.3 as the book is about to go to press, 2004. I thought IDLE came bundled with Python. I have Py 2.5. 1.2.2??? Puzzled. IDLE is a separate product; the version of IDLE that comes with Python 2.5.4 is 1.2.4 Where do I get 2.x.x, or the latest? You may update your Python version to 2.5.4 (the latest release in the 2.5 series). Then IDLE will report 1.2.4. They are separate products, their version numbers are uncorrelated. Ah, I see, the book is referring to version 2.3 of Python and not IDLE. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
David Smith wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. What I meant was open open the command prompt, type cd, space, DO NOT hit enter yet. Drag the folder with your script into the command prompt window. Then go to the command prompt window and hit enter. This should compose a command similar to the following: C:\Documents and Settings\user cd C:\Documents and Settings\user\My Documents\My Project C:\Documents and Settings\user\My Documents\My Project _ --David Ah, I thought I'd be clever and do a copy on the path name in the address area at the top of the folder. That doesn't work. I'm quite surprised though that one can do the drag as you say. But, hey, it works. Thanks. I wonder what else non-DOS things can be done in it? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Keeping the Console Open with IDLE
W. eWatson wrote: David Smith wrote: W. eWatson wrote: I'm not sure whether I should feel old or write a smart alec comment -- I suppose there are people in the world who don't know what to do with a command prompt Assuming a Windows system: 2. Type 'cd ' (as in Change Directory) in the command prompt window (w/o the single quote characters) 3. Drag/drop the folder containing your python script to your command prompt window 4. Hit enter in your command prompt window. 5. Type python my_script_name.py to execute my_script_name.py. --David If I enter just cd, then it tells me cd is not defined. If I enter c:/python25, it tells me I have a syntax error at c in c:. The title of the black background window I have up with a prompt shown in it is Python(command line). Maybe this isn't the real Python console window? What I want is that if I execute the program by double clicking on its name to display the console window with the program or syntax errors shown without it closing in a split second. Putting read_raw in it doesn't work, since some error prevents it from ever being seen. What I meant was open open the command prompt, type cd, space, DO NOT hit enter yet. Drag the folder with your script into the command prompt window. Then go to the command prompt window and hit enter. This should compose a command similar to the following: C:\Documents and Settings\user cd C:\Documents and Settings\user\My Documents\My Project C:\Documents and Settings\user\My Documents\My Project _ --David Ah, I thought I'd be clever and do a copy on the path name in the address area at the top of the folder. That doesn't work. I'm quite surprised though that one can do the drag as you say. But, hey, it works. Thanks. I wonder what else non-DOS things can be done in it? Well, there is a difficulty with this method. The path is very long, and one must change the property width of the window. However, putting the name of a long py file further complicates this. The negative surprise here is that I'm trying to avoid executing the program in IDLE, because I'm told elsewhere it produced erroneous error msgs. They are exactly the same here. I'll take this up on another thread. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Which Version of wxPython for Win XP
I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Version of wxPython for Win XP
eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ There is a good chance you don't care... I think the other is for internationalization... best to look.. It would be easier to answer the question if you said what you are going to do with it, and who needed to use your software. It's even possible that you might want to try pygame depending on what you want to use it for and who the audience is (and how good thier computers are) http://pypi.python.org/simple/Dex%20Tracker/ Thanks. I think I'll take the chance. Somewhat simple programming. Off I go to install it. It can always be un-installed. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Version of wxPython for Win XP
W. eWatson wrote: eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ There is a good chance you don't care... I think the other is for internationalization... best to look.. It would be easier to answer the question if you said what you are going to do with it, and who needed to use your software. It's even possible that you might want to try pygame depending on what you want to use it for and who the audience is (and how good thier computers are) http://pypi.python.org/simple/Dex%20Tracker/ Thanks. I think I'll take the chance. Somewhat simple programming. Off I go to install it. It can always be un-installed. Well, that was an interesting experience. It appears to have recompiled a lot of stuff, and probably some libraries. IDLE is still with me as the way to open py files. Apparently, if I want to get around IDLE, I may have to install some other editor. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Version of wxPython for Win XP
Mike Driscoll wrote: On Feb 19, 11:29 am, W. eWatson notval...@sbcglobal.net wrote: W. eWatson wrote: eric_dex...@msn.com wrote: On Feb 19, 8:22 am, W. eWatson notval...@sbcglobal.net wrote: I'm going to try out wxPython 2.8.92 for py25. It seems like the ansi version is the choice for me. The other choice has unicode. Do I care? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ There is a good chance you don't care... I think the other is for internationalization... best to look.. It would be easier to answer the question if you said what you are going to do with it, and who needed to use your software. It's even possible that you might want to try pygame depending on what you want to use it for and who the audience is (and how good thier computers are) http://pypi.python.org/simple/Dex%20Tracker/ Thanks. I think I'll take the chance. Somewhat simple programming. Off I go to install it. It can always be un-installed. Well, that was an interesting experience. It appears to have recompiled a lot of stuff, and probably some libraries. IDLE is still with me as the way to open py files. Apparently, if I want to get around IDLE, I may have to install some other editor. -- W. eWatson The compiling you are referring to is just making the py files into pyc files. This is normal and is a speed improvement. In fact, a lot of the scripts you write will create a pyc file when first run. In other words, wxPython does not affect your Python install in any way other than making itself available as a 3rd party package (i.e. adding itself to the path), just like any other good 3rd party package. I'm not sure why you're even talking about IDLE...wxPython is a GUI toolkit, not an IDE. Mike Thanks. Yes, I finally discovered that the need here was not what I wanted afterall. Un-installed now. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Keeping the Console Open with IDLE
I'm using IDLE for editing, but execute programs directly. If there are execution or compile errors, the console closes before I can see what it contains. How do I prevent that? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
Terry Reedy wrote: W. eWatson wrote: From Diez above. What does *NOT* work is writing a Tkinter-based app in idle, and to run it *FROM INSIDE* idle. Instead, open your explorer and double-click on the pyhton-file your app is in. That's all that there is to it. So this is the absolute truth? No wiggle room? One can never use a Tkinter program with IDLE, and execute it successfully. So IDLE doesn't issue a standard warning that says, Get out of here with your Tkinter program, it will fail when you try to run it here. You have entered Tkinter hell. Good-bye. Re-read my post about kids fighting to control a television. Maybe they work together, maybe they crash the TV. Hard to predict. ***ANY*** Python program that tries to grab and control the same resources that TK does may conflict with it. There is no way that IDLE can have a list of, for instance, all event-grabbing mainloop programs. OK, enough tinkering with the code and others matters on my end trying to find a work around. Somehow after much successful use of IDLE's execution facility, I've stepped on an invisible banana peel. I think it's evident that I'm not going around this problem easily with the IDLE execution attempts, and that another solution is required. First, I think somewhere up the thread someone suggested that Active pythonWin is not dependent upon Tk, correct? Therefore, it is immune from such problems, correct? Second, maybe I missed it above, but when I posted the output from the program that showed the failure, was there anything that said, IDLE problem or would even give a clue that's the culprit? Finally, we can probably agree that I can continue to use IDLE for editing and syntax checking, but to guarantee successful execution of the program, I can just double-click on the py file in my folder. Perhaps there is a better way than clicking on it in the folder. For example, putting it on the desktop. As I look at the folder, previous copies only differ by a digit, I can easily find myself executing an earlier version, differing as Dev4, to Dev5 at the end of each name. Let me ask this. When I install Active Python, am I getting something beyond their interface? That is, does executing the code there result in using the same python interpreter that is used by IDLE? My use of their editor has been somewhat exasperating. It does not seem as friendly as the IDLE editor. I still find it bizarre that the original creator of this program can spend months using IDLE to develop this program, and that I've spent maybe 10 days recently now adding to it without having much, if any, problem with IDLE and the programs execution within IDLE. I asked him almost a year ago what tool he used. IDLE, was the reply. Maybe it was really IDLE with no execution from inside IDLE. I'll ask him. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
Scott David Daniels wrote: W. eWatson wrote: Terry Reedy wrote: W. eWatson wrote: From Diez above. What does *NOT* work is writing a Tkinter-based app in idle, and to run it *FROM INSIDE* idle. Instead, open your explorer and double-click on the pyhton-file your app is in. That's all that there is to it. So this is the absolute truth? No wiggle room? One can never use a Tkinter program with IDLE, and execute it successfully. So IDLE doesn't issue a standard warning that says, Get out of here with your Tkinter program, it will fail when you try to run it here. You have entered Tkinter hell. Good-bye. Re-read my post about kids fighting to control a television. Maybe they work together, maybe they crash the TV. Hard to predict. ***ANY*** Python program that tries to grab and control the same resources that TK does may conflict with it. There is no way that IDLE can have a list of, for instance, all event-grabbing mainloop programs. OK, enough tinkering with the code and others matters on my end trying to find a work around. Somehow after much successful use of IDLE's execution facility, I've stepped on an invisible banana peel. I think it's evident that I'm not going around this problem easily with the IDLE execution attempts, and that another solution is required. That's correct, but you still don't understand _why_ it is correct. I suggest you re-read the thread and try to understand everything you are being told. First, I think somewhere up the thread someone suggested that Active pythonWin is not dependent upon Tk, correct? Therefore, it is immune from such problems, correct? Wrong. I was the one who said that ActiveState had a product to debug Python programs across a nertwork connection. The product is _not_ ActivePython (the freely distributed system), but rather the Komodo IDE, which does cost money. I'm pretty sure it wasn't you, and had no relationship to what you brought up earlier several messages up the thread. There are other forums. Finally, we can probably agree that I can continue to use IDLE for editing and syntax checking, but to guarantee successful execution of the program, I can just double-click on the py file in my folder. Perhaps there is a better way than clicking on it in the folder. For example, putting it on the desktop. As I look at the folder, previous copies only differ by a digit, I can easily find myself executing an earlier version, differing as Dev4, to Dev5 at the end of each name. OK, you are using the oldest and least useful revision control system, rename and remember. I'd suggest you get and use bazaar, but you'll just ask for shortcuts on how to use it without understanding what it does. It works for me, and, frankly, I'm not interested in going to Linux, SunOS or other revision systmes. These are way in my distant past, and the only reason I'm currently, and begrudgingly, once again writing programs is that the Python software program I am using is limited in its ability. I've finally, after 2-3 years of hoping someone else would do it, taken up the torch to add new features. Frankly, I'd rather be doing something else with my time. And, yes, you are somewhat correct in your earlier assessment of my goals, the sooner this is over the better. You may not like my philosophy, but it serves me well at the moment, and I'm moving ahead nicely now. As I recall from the old movie Desk Set, a conversation between their two characters regarding a puzzle he was about to give her as a test of her office abilities: Tracy cautions Hepburn, Never assume! before relating the famous detective problem. Never assume. Nevertheless, thank you for your responses. Be kind to your keyboard. Cheers. --Scott David Daniels scott.dani...@acm.org -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
... How can it? It's not IDLE's problem, it's yours. Finally, we can probably agree that I can continue to use IDLE for editing and syntax checking, but to guarantee successful execution of the program, I can just double-click on the py file in my folder. Perhaps there is a better way than clicking on it in the folder. Typing at a command prompt. For example, putting it on the desktop. This causes an extra file read as Windows indirects through the desktop link. It's unlikely to be a noticeable delay at startup, but I'd hesitate to call it better. As I look at the folder, previous copies only differ by a digit, I can easily find myself executing an earlier version, differing as Dev4, to Dev5 at the end of each name. I'd suggest spending a while reading up on version control systems. See my response to Scott. Thanks for your reply. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Untangling pythonWin and IDLE Processes on XP Pro
It appears if one moves between IDLE and pythonWin (pyWin) that two separate loops (threads?) can occur, and that IDLE can produce incorrect results. Since I have preferred IDLE over pyWin, that leaves me currently in a quandry. How do I renew these processes, so that I can proceed with IDLE? I noticed that I had about 10-15 copies of pythonw.exe as I tried to reach some understanding of what was going on. Killing these tasks didn't help restore order to IDLE. It seems my only choice now is to reboot? Comments? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
Diez B. Roggisch wrote: W. eWatson wrote: It appears if one moves between IDLE and pythonWin (pyWin) that two separate loops (threads?) can occur, and that IDLE can produce incorrect results. Since I have preferred IDLE over pyWin, that leaves me currently in a quandry. How do I renew these processes, so that I can proceed with IDLE? I noticed that I had about 10-15 copies of pythonw.exe as I tried to reach some understanding of what was going on. Killing these tasks didn't help restore order to IDLE. It seems my only choice now is to reboot? Comments? Gosh no, rebooting shouldn't be needed. Just quit all idle pywin processes, including of course the main programs. Which *should* be anything that is needed anyway. Done that. Been there. It doesn't work. If I take another py tkinter program and run it in IDLE, it *will work*. The current program goes boom. And you still seem to not understand what is really happening. Whether I understand it exactly or not is not the issue. The issue is how do I execute IDLE *now* to get the correct results it once allowed? The fact of the matter is that I was happily working in IDLE for days and hours. I encountered a problem in IDLE that seemed suspicious, so I then fired up pyWin to see if it gave the same results. It worked fine. Then my problems with IDLE got worse. Working between pywin and idle is perfectly fine, they are separate programs. You can start as many instances of a program as you want and happily work with them. Even several instances of idle and pywin, unless these come with some logic to prevent multiple starts - some windows app do that. How could this be true; otherwise, I wouldn't be complaining? What does *NOT* work is writing a Tkinter-based app in idle, and to run it *FROM INSIDE* idle. Instead, open your explorer and double-click on the pyhton-file your app is in. That's all that there is to it. Personally, I like running entirely in IDLE. If there is no other way than you suggested in NOT work, then I may just uninstall pyWin. Diez -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
I simply ask, How do I get around the problem? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
As with Diez, I simply ask, How do I get around the problem? Are you two telling me that it is impossible? OK, here's my offer to both of you. Do you have IDLE for Python 2.5 and have good familiarity with Tkinter? If so, I'll send you the code and you can try it yourself. My guess is that it will work, and if not, and you are sufficiently skilled with Tkinter and debugging, you may find the problem in the code. The steps to create the problem are very easy. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
W. eWatson wrote: As with Diez, I simply ask, How do I get around the problem? Are you two telling me that it is impossible? OK, here's my offer to both of you. Do you have IDLE for Python 2.5 and have good familiarity with Tkinter? If so, I'll send you the code and you can try it yourself. My guess is that it will work, and if not, and you are sufficiently skilled with Tkinter and debugging, you may find the problem in the code. The steps to create the problem are very easy. Well, this may be a bit trickier than I thought. I'd have to give you the same PIL, tkinter, numpy libraries the program users. However, Im willing to send the files for them to you. Here's the start of the code = from Tkinter import * from numpy import * import Image import ImageChops import ImageTk import ImageDraw # wtw import time import binascii import tkMessageBox import tkSimpleDialog from pylab import plot, xlabel, ylabel, title, show, xticks, bar from tkFileDialog import asksaveasfilename, asksaveasfile from tkFileDialog import askopenfilename import MakeQTE === You'd also need clut.txt, wagon.gif, and MakQTE. All small files. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
Greetings and salutations. I just uninstalled all traces of (Active) pythonWin 2.5.2 from this machine, In fact, I uninstalled python 2.5.2 with IDLE from this machine. I then reinstalled the latter. Then I ran the program. XP Pro. I then went to another machine that has never had pythonWin on it all, but does have python 2.5.2 with IDLE. I ran the same program there. W2K. In both cases, I got the output below. Your conclusions? ===Output on Interactive Shell Screen=== GUI self---: __main__.Sentuser_GUI instance at 0x02154058 counter: 3 OSett self = __main__.Sentuser_GUI instance at 0x02154058 type = type 'instance' gray scale now--wtw: True Set OSDiag sdict body from OSDialog, self = .35167928 type = type 'instance' apply OSD ok Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\Lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 553, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\Lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .35167928 was deleted before its visibility changed -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Untangling pythonWin and IDLE Processes on XP Pro
From Diez above. What does *NOT* work is writing a Tkinter-based app in idle, and to run it *FROM INSIDE* idle. Instead, open your explorer and double-click on the pyhton-file your app is in. That's all that there is to it. So this is the absolute truth? No wiggle room? One can never use a Tkinter program with IDLE, and execute it successfully. So IDLE doesn't issue a standard warning that says, Get out of here with your Tkinter program, it will fail when you try to run it here. You have entered Tkinter hell. Good-bye. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Who's on First, IDLE or pythonWin? Dialog Problem?
My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
Mike Driscoll wrote: On Feb 11, 10:28 am, W. eWatson notval...@sbcglobal.net wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Note the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. You don't really say what your code does or if it uses a GUI toolkit and if so, which one. But my guess is that you are using some kind of GUI and its GUI and IDLE's are clashing somehow. I see this sort of thing with some of my wxPython programs from time to time, although IDLE usually just crashes with no error message. I would recommend using the command line or something that can open it in a completely separate process, such as Wingware's IDE. Mike Tkinter. Isn't just clicking on the py file enough to side step either of the two? I did it and it worked fine. The code is for a GUI that has five or so menus on the main window bar, and manipulates video that is downloaded to it from a video camera. The problem occurs in a dialog in which a user enters configuration values, like the time to start/stop the camera. As soon as I press OK on the dialog the program dies as above. It wasn't doing that at all for days despite some heavy editing. A WinMerge shows its quite faithful to it's last working predecessor. That's how I found the get problem. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
Steve Holden wrote: W. eWatson wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. Well you have to remember that you are trying to run a windowed GUI under the control of another windows GUI, so it isn't surprising that you hit trouble. With IDLE the issue will be that IDLE already created a main window before your program started running. With PythonWin you are using two different toolkits, so it isn't really surprising that breaks down - there will be two entirely separate main loops competing with each other. regards Steve Not quite. I take down IDLE when I run pyWin, and vice versa. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
Steve Holden wrote: W. eWatson wrote: Steve Holden wrote: W. eWatson wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. Well you have to remember that you are trying to run a windowed GUI under the control of another windows GUI, so it isn't surprising that you hit trouble. With IDLE the issue will be that IDLE already created a main window before your program started running. With PythonWin you are using two different toolkits, so it isn't really surprising that breaks down - there will be two entirely separate main loops competing with each other. Not quite. I take down IDLE when I run pyWin, and vice versa. The two separate loops being PyWin (which uses MFC) and your program (which uses Tkinter). You just can't mix GUIs in the same process like that, sorry. regards Stedve I have no idea what MFC is or how it relates to Tkinter. Neither IDLE and pyWin are being run together. Assume neither is running. a. run IDLE, and execute program b. close IDLE script, and interactive window. Kill py program result: boom c. run pyWin and execute program d. do same as b for pyWin resulst: all OK e. repeat a and b. Result: boom Repeat the above and you get the same results. I had running IDLE successfully w/o using Pywin, and IDLE goofed, as above. I switched to it to see if it work there. It did. I double clicked on the py file, and it worked fine. Can you explain this? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
Mike Driscoll wrote: On Feb 11, 3:27 pm, W. eWatson notval...@sbcglobal.net wrote: Steve Holden wrote: W. eWatson wrote: Steve Holden wrote: W. eWatson wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. Well you have to remember that you are trying to run a windowed GUI under the control of another windows GUI, so it isn't surprising that you hit trouble. With IDLE the issue will be that IDLE already created a main window before your program started running. With PythonWin you are using two different toolkits, so it isn't really surprising that breaks down - there will be two entirely separate main loops competing with each other. Not quite. I take down IDLE when I run pyWin, and vice versa. The two separate loops being PyWin (which uses MFC) and your program (which uses Tkinter). You just can't mix GUIs in the same process like that, sorry. regards Stedve I have no idea what MFC is or how it relates to Tkinter. Neither IDLE and pyWin are being run together. Assume neither is running. a. run IDLE, and execute program b. close IDLE script, and interactive window. Kill py program result: boom c. run pyWin and execute program d. do same as b for pyWin resulst: all OK e. repeat a and b. Result: boom Repeat the above and you get the same results. I had running IDLE successfully w/o using Pywin, and IDLE goofed, as above. I switched to it to see if it work there. It did. I double clicked on the py file, and it worked fine. Can you explain this? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ What Steve (and I) are saying is that IDLE has it's own mainloop and your program has a mainloop too as it sounds like it is running a Tkinter app. Sometimes when you run a Tk app from another Tk app, the two mainloops clash and have weird issue like this one. If you just double-click it or run it from the command line, you only have one mainloop (i.e. the one that's part of your app). Thus, no conflicts. Mike So, how do I get rid of it? reboot? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
drobi...@gmail.com wrote: On Feb 11, 2:51 pm, Steve Holden st...@holdenweb.com wrote: W. eWatson wrote: Steve Holden wrote: W. eWatson wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. Well you have to remember that you are trying to run a windowed GUI under the control of another windows GUI, so it isn't surprising that you hit trouble. With IDLE the issue will be that IDLE already created a main window before your program started running. With PythonWin you are using two different toolkits, so it isn't really surprising that breaks down - there will be two entirely separate main loops competing with each other. Not quite. I take down IDLE when I run pyWin, and vice versa. The two separate loops being PyWin (which uses MFC) and your program (which uses Tkinter). You just can't mix GUIs in the same process like that, sorry. regards Stedve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ Deja-vu! http://mail.python.org/pipermail/python-list/2001-March/076069.html The question now is what can I do about it? reboot? Just to re-iterate the answer I provided the answer to above, I'm using Tkinter for the program's GUI. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's on First, IDLE or pythonWin? Dialog Problem?
drobi...@gmail.com wrote: On Feb 11, 2:51 pm, Steve Holden st...@holdenweb.com wrote: W. eWatson wrote: Steve Holden wrote: W. eWatson wrote: My program in IDLE bombed with: == Exception in Tkinter callback Traceback (most recent call last): File C:\Python25\lib\lib-tk\Tkinter.py, line 1403, in __call__ return self.func(*args) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 552, in OperationalSettings dialog = OperationalSettingsDialog( self.master, set_loc_dict ) File C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py, line 81, in __init__ tkSimpleDialog.Dialog.__init__(self, parent) File C:\Python25\lib\lib-tk\tkSimpleDialog.py, line 69, in __init__ self.wait_visibility() # window needs to be visible for the grab File C:\Python25\lib\lib-tk\Tkinter.py, line 415, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) TclError: window .34672232 was deleted before its visibility changed === It runs fine in pythonWin performing the same entry operation. Open a menu, select an item to open a dialog, select a select button in the dialog, press OK to leave the dialog. Boom, as above. (This does not mean pythonWin doesn't have problems of its own. ) If I just execute the code (double click on the py file, the console shows no problems. IDLE is unhappy. Another side to this is that I use WinMerge to find differences between my last saved copy and the current copy. I found the current copy had two lines where a abc.get() was changed to abc.get. This was undoubtedly from briefly using the pyWin editor, when I mis-hit some keys. Yet pyWin had no trouble executing the program. My guess is that while briefly editing there, I hit some odd combination of keys that produced, perhaps, an invisible character that pyWin ignores. Not the 34672232 window is a dialog that I closed by pressing OK. I would again guess, that, if there is a problem, it occurs in the code that destroys the dialog. Well you have to remember that you are trying to run a windowed GUI under the control of another windows GUI, so it isn't surprising that you hit trouble. With IDLE the issue will be that IDLE already created a main window before your program started running. With PythonWin you are using two different toolkits, so it isn't really surprising that breaks down - there will be two entirely separate main loops competing with each other. Not quite. I take down IDLE when I run pyWin, and vice versa. The two separate loops being PyWin (which uses MFC) and your program (which uses Tkinter). You just can't mix GUIs in the same process like that, sorry. regards Stedve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ Deja-vu! http://mail.python.org/pipermail/python-list/2001-March/076069.html The question now is what can I do about it? reboot? Just to re-iterate the answer I provided the answer to above, I'm using Tkinter for the program's GUI. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7 N, 121° 2' 32 W, 2700 feet Web Page: www.speckledwithstars.net/ -- http://mail.python.org/mailman/listinfo/python-list