"Gabriel Genellina" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > En Fri, 07 Mar 2008 13:56:45 -0200, K Viltersten <[EMAIL PROTECTED]> > escribi�: > >>>> 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? > > No, use IDLE if you prefer, or any other editor/IDE. But in your case > there is an unfortunate coupling between IDLE and your script. Fix: change > the quit method as suggested in this thread: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/92bee52a3e2a325e/ > > def quit(self): > self.master.destroy() > > This is OK if used on the top level widget on the application (your Demo > class, for instance). A more general solution: > > def quit(self): > parent = self > while parent.winfo_class() != 'Tk': > if parent.master is None: > break; > parent = parent.master > else: > parent.destroy() > > (from > https://sourceforge.net/tracker/index.php?func=detail&aid=661324&group_id=9579&atid=109579 > > ) > > This appears to work fine. But the loop, as written, could exit without > calling destroy() on anything; perhaps some other people knowing better > how Tkinter and Tk work could improve it or confirm it's fine as it is.
Thank you. I'll try that tomorrow. -- Regards Konrad Viltersten -------------------------------- sleep - a substitute for coffee for the poor ambition - lack of sense to be lazy -- http://mail.python.org/mailman/listinfo/python-list