答案 0 :(得分:1)
你的意思是Gtk.StackSwitcher? Gtk.Stack是空容器,Gtk.StackSwitcher成为“标题”
from gi.repository import Gtk
win = Gtk.Window ()
grid = Gtk.Grid ()
win.add (grid)
stack = Gtk.Stack ()
childstack = Gtk.Entry ()
stack.add_titled (childstack, "_Namestack", "LabelInTheSwitcher")
grid.attach (stack, 0, 1, 1, 1)
switcher = Gtk.StackSwitcher ()
switcher.set_stack (stack)
grid.attach (switcher, 0, 0, 1, 1)
""" Use icon instead for your switcher """
stack.child_set_property (childstack, "icon-name", "help-about")
win.show_all ()
win.connect ("destroy", Gtk.main_quit)
Gtk.main ()