470,821 Members | 1,933 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,821 developers. It's quick & easy.

ps tkinter

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)

Feb 7 '07 #1
1 1310
On Wed, 07 Feb 2007 13:40:33 +0100, yvesd <yv************@gmail.comwrote:
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+-'])"
Feb 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by srijit | last post: by
1 post views Thread by syed_saqib_ali | last post: by
reply views Thread by syed_saqib_ali | last post: by
1 post views Thread by Michael Yanowitz | last post: by
3 posts views Thread by dwelch91 | last post: by
1 post views Thread by yvesd | last post: by
8 posts views Thread by karthikbalaguru | last post: by
3 posts views Thread by joshdw4 | last post: by
3 posts views Thread by J-Burns | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.