[英]No “HeaderBar” property of GTK3 in python
I have this simple window - 我有这个简单的窗口 -
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()
But when I run it, it gives me a error - 但是当我运行它时,它给了我一个错误 -
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'
GTK+ provides GtkHeaderBar since GTK 3.10 . GTK + 自GTK 3.10起提供GtkHeaderBar 。 You're most likely using an older version of GTK 3. Check that the unmodified example program runs on your machine.
您最有可能使用旧版本的GTK 3.检查未修改的示例程序是否在您的计算机上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.