--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
I'm writing a test wrapper for a dialog module that doesn't terminate
the application. How can I exit the test program when the dialog is
dismissed?
Attached is a minimal version that illustrates the problem. When it
self.destroy()'s itself, we're hung. mainloop() is still spinning.
As you can see, I did try WM_DELETE_WINDOW.
Thanks for any tips,
Randall
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dialog.py"
#!/usr/bin/env python
import sys
from Tkinter import *
from ScrolledText import ScrolledText
class CommandWindow(ScrolledText):
def __init__(self, master=None, **cnf):
apply(ScrolledText.__init__, (self, master), cnf)
class CommandWindowDialog(Toplevel):
def __init__(self, master=None, **cnf):
apply(Toplevel.__init__, (self, master), cnf )
self.title( 'COMMAND OUTPUT' )
win = CommandWindow( self )
win.pack(expand=1, fill=X)
btn = Button( self, text="Quit", command=self.destroy )
btn.pack()
root = Tk()
w = CommandWindowDialog( root )
w.protocol( 'WM_DELETE_WINDOW', sys.exit )
root.wm_withdraw()
w.mainloop()
--tThc/1wpZn/ma/RB--
Content-Type: text/plain; charset=us-ascii
I'm writing a test wrapper for a dialog module that doesn't terminate
the application. How can I exit the test program when the dialog is
dismissed?
Attached is a minimal version that illustrates the problem. When it
self.destroy()'s itself, we're hung. mainloop() is still spinning.
As you can see, I did try WM_DELETE_WINDOW.
Thanks for any tips,
Randall
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dialog.py"
#!/usr/bin/env python
import sys
from Tkinter import *
from ScrolledText import ScrolledText
class CommandWindow(ScrolledText):
def __init__(self, master=None, **cnf):
apply(ScrolledText.__init__, (self, master), cnf)
class CommandWindowDialog(Toplevel):
def __init__(self, master=None, **cnf):
apply(Toplevel.__init__, (self, master), cnf )
self.title( 'COMMAND OUTPUT' )
win = CommandWindow( self )
win.pack(expand=1, fill=X)
btn = Button( self, text="Quit", command=self.destroy )
btn.pack()
root = Tk()
w = CommandWindowDialog( root )
w.protocol( 'WM_DELETE_WINDOW', sys.exit )
root.wm_withdraw()
w.mainloop()
--tThc/1wpZn/ma/RB--