faqts : Computers : Programming : Languages : Python : Tkinter

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 8 people (75%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

In tkinter, how do you change a widget's parent?

Aug 10th, 2000 23:52
unknown unknown, keith murphy, Richard Chamberlain


Tricky one this.
FYI you can get widget options via either config() or keys(). So for
instance if you did:
entry=Entry(root,width=20)
then
print entry.config().keys()
or entry.keys()
would show you all the available options for that widget. You should use
a combination of both because they both show some things and not others.
There isn't a parent option, nor a method (not one that I know of at
least). 
The only way I know of doing it would be to use pack_forget() (or for
the grid-master grid_forget() or grid_remove()) and then assign the
variable to another widget in another frame.
If it's a complicated widget then wrap the whole thing a function with
parent as an argument so all you need to do is call the function to
recreate it.