Tkinter widgets into classes.

albert visser albert.visser at gmail.com
Sun Feb 2 01:46:07 CET 2014


On Sun, 02 Feb 2014 00:07:00 +0100, Lewis Wood <fluttershy363 at gmail.com>  
wrote:

> On Saturday, 1 February 2014 22:26:17 UTC, Dave Angel  wrote:
>> Lewis Wood <fluttershy363 at gmail.com> Wrote in message:
(snip)
>>
>> DaveA
>
> It does, this is the whole code:
>
> from tkinter import *
>
> root=Tk()
> root.title("Second Root Testing")
>
>
>
> def secondwindow():
>     root2=Tk()
>     root2.mainloop()
>
this may seem to work, but you're starting a new event loop here instead  
of using the current one. I think you want to create another TopLevel()  
window here, not a new Tk instance.
>
> button1=Button(root,text="Root2",command=secondwindow).grid(row=0,column=0)
>
Note that if you want to be able to actually use the button1 symbol, you  
have to break this statement up:

button1=Button(root,text="Root2",command=secondwindow)
button1.grid(row=0,column=0)

You can't shortcut this because grid() returns None.
>
> root.mainloop()
>


-- 
Vriendelijke groeten / Kind regards,

Albert Visser

Using Opera's mail client: http://www.opera.com/mail/



More information about the Python-list mailing list