可以在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()
0
这可能吗?
答案 0 :(得分:3)
Stack文档包含position
子属性:
child = stack.get_visible_child()
if child is not None:
position = stack.child_get_property(child, "position")