Gtk3 replace child widget with another widget

后端 未结 4 1668
执念已碎
执念已碎 2021-01-17 10:25

I\'m looking for a way to remove a widget from its parent (whatever that may be - a VBox, a Grid, ...) and add a substitute widget in its place.

I found this answer,

4条回答
  •  时光取名叫无心
    2021-01-17 10:41

    This has only recently become possible, since PyGObject 3.14: https://git.gnome.org/browse/pygobject/commit/?h=pygobject-3-14&id=bf84915f89fd5fd502b4fb162eef7bc0a48c8783

    Either of the following will work in PyGObject 3.14 and later:

    parent.list_child_properties()
    Gtk.ContainerClass.list_child_properties(parent)
    

    (The second syntax is in case class and instance methods have a naming conflict. See discussion here.)

提交回复
热议问题