我可以将Icon设置为标题为Gtk.StackSwitcher吗?

时间:2014-05-13 17:55:28

标签: python pygtk gtk3

我想用pyGTK设置一个标题为Gtk.StackSwitcher的图标。

有可能吗?我没有在documentation中看到。

提前致谢!

1 个答案:

答案 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 ()