0
否“HeaderBar”属性我有这个简单的窗口 -GTK3的蟒蛇
from gi.repository import Gtk
class Simplicity(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
hb = Gtk.HeaderBar()
hb.props.show_close_button = True
hb.props.title = "HeaderBar example"
self.set_titlebar(hb)
self.connect("delete-event", Gtk.main_quit)
window = Simplicity()
window.show_all()
Gtk.main()
但是当我运行它,它给了我一个错误 -
Traceback (most recent call last):
File "simplicity.py", line 17, in <module>
window = Simplicity()
File "simplicity.py", line 10, in __init__
hb = Gtk.HeaderBar()
File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in __getattr__
return getattr(self._introspection_module, name)
File "/usr/lib/python2.7/dist-packages/gi/module.py", line 105, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Gtk' object has no attribute 'HeaderBar'
这是怎么回事?我看到这个例子here
原始文件不运行 – svineet
您是否检查过您使用的是哪个版本的GTK? – liberforce
我在GNOME 3.4.2上,所以我认为3.4?我不知道如何检查 – svineet