ps tkinter

Y

yvesd

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

Eric Brunel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top