Tkinter, Trouble with Message,Label widget

Ioannis Lalopoulos isgrey at
Mon May 4 05:47:20 CEST 2009

I assume that you create the two windows through two different calls
to Tkinter.Tk() but you cannot enter two mainloops (at least not in a
normal way).

If you want a second window use the Toplevel widget.

Try the following, it does what you want:

import Tkinter

root = Tkinter.Tk()

my_text = Tkinter.StringVar(root)

another_window = Tkinter.Toplevel()

entry = Tkinter.Entry(root, textvar=my_text)

label = Tkinter.Label(another_window, textvar=my_text)


In the above example, whatever you type in the entry widget in the
root window gets reflected in the label widget which is inside the
second window, the one that was created with Tkinter.Toplevel().

Hope it helps,


More information about the Python-list mailing list