ps tkinter

Eric Brunel eric_brunel at despammed.com
Wed Feb 7 08:38:13 EST 2007


On Wed, 07 Feb 2007 13:40:33 +0100, yvesd <yves.delalande at gmail.com> wrote:

> For a bit more help about my previous message (outlook bar)
> does anybody know how to reparent or change a widget(button)'s owner
> in tkinter ?
> here's my code that doesn't work :
>     def inverse(self):
>         if (self.texte=="top"):
>             self.texte="bottom"
>             btn = self
>             btn.pack_forget()
>             btn.configure(parent = self.top, text=self.texte)
>             btn.pack(side=TOP,fill=X,expand=1)
>         else:
>             self.texte="top"
>             btn = self
>             btn.pack_forget()
>             btn.configure(parent=self.bottom, text=self.texte)
>             btn.parent = None
>             btn.pack(side=BOTTOM,fill=X,expand=1)

Short answer: you can't. At tcl level, the name for the button contains  
the name of its parent, and you basically can't rename a button.

But, having no idea about what you call an "outlook bar" since I never  
used outlook in my whole life, another solution may exist, not requiring  
to "reparent" an existing widget. If you only describe exactly what you're  
trying to do, someone may be able to provide far better help.
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list