SV: Quit-command not quiting

K Viltersten tmp1 at viltersten.com
Fri Mar 7 10:56:45 EST 2008


>> The window itself vanishes if i click the
>> cross in the upper-right corner but pressing
>> the quit-button only makes it "pressed".
>> Then, the program freezes.
> 
> How did you run it? From inside IDLE? IDLE itself is written 
> using Tk, and  I think that your mainloop interferes with the 
> one inside it. If you run your program from the command line 
> it should work fine.

I press F5 while in the editor window. Is there a way to run the
program without going to the console window?

Perhaps i'm just making things unneccesarily complicated 
and Python IS supposed to be run from console window?

>> from Tkinter import *
>> class Demo (Frame):
>>     def __init__ (self, master = None):
>>         Frame.__init__ (self, master)
>>         self.grid ()
>>         self.doLayout ()
>>     def doLayout (self):
>>         self.quitButton = Button (
>>             self,
>>             text = "Quit",
>>             command = self.quit)
>>         self.quitButton.grid ()
>>
>> d = Demo ()
>> d.master.title ("the coolest demo ever")
>> d.mainloop ()
> 
> There is only one thing I hate more than spaces after a 
> parens: spaces  before it :)
> Please read PEP8, about the suggested style for writting 
> Python code. http://www.python.org/dev/peps/pep-0008/

I've got no issues one way or the other. Most likely i'll forget
from time to time but other than that, i'll try to keep it in mind.

--
Regards
Konrad Viltersten
--------------------------------
sleep    - a substitute for coffee for the poor
ambition - lack of sense to be lazy




More information about the Python-list mailing list