[pygtk] re-using children widget in other parent
Pascal Duchatelle
pduchatelle at yahoo.fr
Mon Jul 30 16:40:11 WST 2007
Hi,
this will look very basic for many of you but I did not see any mention
neither in the tutorial nor in the reference on how to do the following.
I am trying to re-use children widgets of which I destroyed (maybe not
the right choice) the parent in another parent.
What I did to play (to me is has to stay a game, pleasure) with it is:
create a VBox
create a HPaned in which I put Button1 in the upper paned and Button2
in the lower.
pack the VPaned in the VBox
create a change_button that when clicked calls a redraw_function
pack the change_button in the VBox
the redraw_function :
destroys the VPaned (which again may not be appropriate)
creates a HPaned
(tries to) re-use Button1 and Button2 in HPaned
When I uses it I get the message: GtkWarning: Can't set a parent on
widget which has a parent
I read somewhere that a reference of the child is kept when a
parent widget destroyed. Is that the problem ?
If so I have two questions :
What is the use of keeping this reference since the parent cannot
"live" again (I suppose)
And is there a way to do what I wish to do.
I did not read all the tutorial, but if there is no mention
of this, could it be a (good) idea to at least incorporate a mention
of it. For new users it would be useful.
Thnak you.
Pascal
More information about the pygtk
mailing list