[Tutor] Windows within windows

vicki@stanfield.net vicki@stanfield.net
Thu Feb 20 12:52:03 2003


I am new to Python (have only fixed code not written it
from scratch) and am having some difficulty with
creating multi-window applications. I have been
experimenting with some code to get used to the
toplevel creation. It seems to work fine until I try to
add a list widget. All I get is a quick flash of the
toplevel window. Can someone tell me what I am doing
wrong?

--vicki

---------------------------------------------------
import Tkinter

def cleanup ():
	owSecond.destroy ()
	owFirst.destroy ()
	
owFirst = Tkinter.Tk ()

Tkinter.Label (owFirst, text='This is the first
window').pack ()

Tkinter.list = TkList(['tomato', 'orange',
'persimmons'])
Tkinter.list.pack()
Tkinter.list.reverse()

Tkinter.Message (owFirst, text='Here is a
message').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)