python - 为什么我的 gi.repository.Gtk 一直使用 GTK 2 模块?

标签 python user-interface gtk3 pygobject

我正在设计一个 GUI python 程序,我决定使用 GTK+3。

在这里阅读一些文档:http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html我知道我可以使用 gi.repository.Gtk 模块作为 GTK+3 库的 API。

但是当我尝试这样做时,它一直警告我它正在使用 GTK+2 模块:

>>> import gi.repository.Gtk
/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:47: RuntimeWarning: 
You have imported the Gtk 2.0 module.  Because Gtk 2.0 was not designed 
for use with introspection some of the interfaces and API will fail.
As such this is not supported by the pygobject development team and
we encourage you to port your app to Gtk 3 or greater. PyGTK is the
recomended python module to use with Gtk 2.0
 warnings.warn(warn_msg, RuntimeWarning)

我不知道如何解决这个问题...我怎么才能真正转向使用 GTK+3?

最佳答案

检查您是否已经安装了 GTK+ 3 的开发包。在您的情况下,对于 Ubuntu 12.04,您应该已经安装了 libgtk-3-dev

关于python - 为什么我的 gi.repository.Gtk 一直使用 GTK 2 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11828995/

相关文章:

WPF 按钮相同/推荐宽度

java - 按下“确定”后如何打开新窗口?

python - 如何通过 app.run() 将任意参数传递给 Flask?

python - 几个模块的 Pytest init 设置

python - 相同的代码,不同的错误 : Python init()

python - 在 python 中使用来自 JSON 响应的数据

java - 制作 JAVA GUI 时的布局问题

python - Gtk Popover 菜单未使用默认填充

python - 如何在 python 3.4 中使用 Gtk3 在背景图像上插入小部件?

qt - GTK WebAssembly 在不久的将来支持吗?