如何将 Xfce 小部件与 Pygi 一起使用?
我最近一直在玩 pygi,试图为 xfce 组合一个混音器插件,但是当我尝试从 python 加载 GtkBuilder 文件时,它无法识别 XfceTitledDialog (我试图将其用于配置对话框) )。
使用 xfce 小部件需要做一些特别的事情吗?
这是我到目前为止所得到的:
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gtk,Gdk
>>> builder = Gtk.Builder()
>>> builder.add_from_file('xfvol.ui')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/gtk-2.0/gi/types.py", line 40, in function
return info.invoke(*args)
RuntimeError: Invalid object type `XfceTitledDialog'
将 XfceTitledDialog 更改为 GtkDialog 可以使其工作,但它是错误的小部件。
该小部件可用并且似乎可以在 Glade 中使用。
I've been playing around with pygi recently, trying to put together a mixer plugin for xfce, but when I try to load the GtkBuilder file from python it doesn't recognize the XfceTitledDialog (which I'm trying to use for the configuration dialog).
Is there something special I need to do to use xfce widgets?
Here's what I've got so far:
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gtk,Gdk
>>> builder = Gtk.Builder()
>>> builder.add_from_file('xfvol.ui')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/gtk-2.0/gi/types.py", line 40, in function
return info.invoke(*args)
RuntimeError: Invalid object type `XfceTitledDialog'
Changing XfceTitledDialog to GtkDialog makes it work, but it's the wrong widget.
The widget is available and appears to work in Glade.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置一些glade需要的shell环境变量。
确保这些是您系统上的正确路径并且 xfce 模块位于其中。
Try setting some shell environment variables that glade needs.
Make sure those are the right paths on your system and the the xfce modules are in there.