Making a second window with Tkinter

greenflame alikakakhel at yahoo.com
Fri Jun 2 23:31:12 EDT 2006


Ok so I played with your script. Here is a script that more closely
mimics what I would like to do except that the way I make the variable
deckstr will be different. The only thing I am confused about is that
it opens the second window in the beginning and when I click on the
button, it does nothing even after I have closed the other window.

from Tkinter import *
from string import join

root = Tk()

def showdeck(deck):
   deckwin = Toplevel()
   deckstr = join(deck, "\n")
   Label(deckwin, text=deckstr, justify=LEFT, anchor=W,
font="Courier").pack(fill=X)

L = Button(root, text="Show Deck", font="Courier",
command=showdeck(list('zxcvbnm')))
L.pack()

root.mainloop()




More information about the Python-list mailing list