Newbie Tkinter / Tk Question

Eugene Goodrich bitbucket at isomedia.com
Thu Jan 6 20:32:56 EST 2000


I'm finding that on Windows NT with Python 1.5.2 and Tcl 8.0.5,
calling Toplevel.lift () with no arguments doesn't do what it's
supposed to.  According to some doc I have:

 "Lift
lift(), tkraise(), lift(above), tkraise(above). Move self to the top
of the window stack. If self is a child window, it is moved to the top
of it's[sic] toplevel window. If self is a toplevel window (the root
or a Toplevel window), it is moved in front of all other windows on
the display."

However, I'm finding that the window doesn't really go anywhere.  By
my understanding, the following code should have the second window on
top, but it doesn't.  I have found that if I call lift () and give it
the first window as the arg, it works.  Is this a bug, or am I
misunderstanding something about handling these windows?  

And, finally, should I be searching comp.lang.tcl or somewhere else
for these sorts of answers, or is comp.lang.python OK?

->>>
import Tkinter

def cleanup ():
	owSecond.destroy ()
	owFirst.destroy ()
	
owFirst = Tkinter.Tk ()
Tkinter.Label (owFirst, text='This is the first window').pack ()
owSecond = Tkinter.Toplevel (owFirst)
Tkinter.Label (owSecond, text='This is the second window').pack ()
owFirst.protocol ('WM_DELETE_WINDOW', cleanup)
owSecond.protocol ('WM_DELETE_WINDOW', cleanup)

owSecond.lift ()
owFirst.wait_window (owSecond)
-<<<
   -Eugene
import binascii; print binascii.a2b_base64 ('ZXVnZW5lQGlzb21lZGlhLmNvbQ==')



More information about the Python-list mailing list