Tkinter widgets into classes.

Christian Gollwitzer auriocus at gmx.de
Sun Feb 2 05:22:01 EST 2014


Am 02.02.14 00:07, schrieb Lewis Wood:
> It does, this is the whole code:
>
> from tkinter import *
>
> root=Tk()
> root.title("Second Root Testing")
>
> def secondwindow():
>      root2=Tk()
>      root2.mainloop()
>
>
> button1=Button(root,text="Root2",command=secondwindow).grid(row=0,column=0)
>
> root.mainloop()

I don't know how this works, but it is definitely wrong. If you need 
more than one window, use Toplevel() to create it.

	Christian




More information about the Python-list mailing list