Tkinter widgets into classes.

Lewis Wood fluttershy363 at gmail.com
Sun Feb 2 00:07:00 CET 2014


On Saturday, 1 February 2014 22:26:17 UTC, Dave Angel  wrote:
> Lewis Wood <fluttershy363 at gmail.com> Wrote in message:
> 
> > 
> 
> >> 
> 
> (deleting doublespaced googlegroups trash)
> 
> >> 
> 
> >> 
> 
> >> To put it another way, you only want one mainloop in your code.
> 
> >> 
> 
> >> -- 
> 
> >> 
> 
> >> DaveA
> 
> > 
> 
> > But I can click the button Multiple times and it will create multiple windows?
> 
> > 
> 
> 
> 
> Not using the function you showed. 
> 
> 
> 
> -- 
> 
> DaveA

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()




More information about the Python-list mailing list