GNOME Bugzilla – Bug 725711
GtkStack visible children api is confusing
Last modified: 2014-03-07 03:53:16 UTC
GtkStack visible children functionality is unexpected and undocumented: stack = Gtk.Stack () stack.add_named (Gtk.Label ("label"), "page1") print stack.get_visible_child_name () # None stack.set_visible_child_name ("page1") print stack.get_visible_child_name () # None I've looked at the source so I know that the widget needs to be visible (as in Widget.get_visible()) before it can be a "visible child". The API feels misleading: The first get_visible_child_name() returns None, but if I had set the widget visible first it would have returned "page1". What's worse, the explicit set_visible_child_name() call just fails silently. If this is intended, it should at least be documented.
The underlying issue here is that widgets are not visible by default. I'm adding a note