Matheus Saraiva Matheus Saraiva - 1 year ago 67
Python Question

How to get the index of visible child in GTK.Stack

Is possible get the index of visible in Gtk.Stack?


>>> stack = Gtk.Stack()
>>> stack.add_named(any_widget1, 'any_widget1') # Index 0
>>> stack.add_named(any_widget2, 'any_widget2') # Index 1
>>> stack.add_named(any_widget3, 'any_widget3') # Index 2
>>> stack.get_visible_child_index()

This is possible?

jku jku
Answer Source

The Stack documentation includes position child property:

child = stack.get_visible_child()
if child is not None:
    position = stack.child_get_property(child, "position")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download