greenflame wrote:
> I have a script that will make a window that shows the text I want
> using Tkinter. What I need to do is to make another window popup above
> the current window showing other text. I tryed:
> 
> -----------
> from Tkinter imprt *
> 
> root = Tk()
> 
> L = Label(root, text="Blah")
> L.grid(row=0, column=0)
> 
> # Other labels are also here but their inclusion is not so relavent.
> 
> root.mainloop()
> 
> sub = Tk()
> 
> subL = Label(root, text="Blah")
> subL.grid(row=0, column=0)
> 
> sub.mainloop()
> ----------
> However, when I ran the script it only showed the second window after I
> closed the first one. After looking at the code I guess I can see why.
> The problem is that I do not know how to fix the issue. Thank you for
> you help.
> 

Use Toplevel().

from Tkinter import *

root = Tk()

def callback(e=None):
   t = Toplevel()
   Label(t, text='blah').pack()

b = Button(root, text='new top', command=callback)
b.pack()
root.mainloop()

Also, do not do this twice in the same script: Tk().

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to