Python gi.repository 窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12981137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gi.repository Windows
提问by Yerko Antonio
I'm developing an app which has to be 100% compatible on windows and on linux. On linux I have no problems, but on windows I came up with this message: from gi.repository import Gtk ImportError: No module named gi
我正在开发一个应用程序,它必须在 windows 和 linux 上 100% 兼容。在 linux 上我没有问题,但在 windows 上我想出了这个消息: from gi.repository import Gtk ImportError: No module named gi
I installed pygobject, pygtkallinone, gtk.. what am I missing?
我安装了 pygobject、pygtkallinone、gtk .. 我错过了什么?
回答by Havok
gi.repositorymodule is called PyGObjectand is for Gtk+3 and is not yet available for Windows (there has been experiments, but is not ready AFAIK). https://live.gnome.org/PyGObject
gi.repository模块被称为PyGObject并且用于 Gtk+3 并且还不能用于 Windows(已经有实验,但还没有准备好 AFAIK)。https://live.gnome.org/PyGObject
gtkmodule is called PyGtkand is for Gtk+2 and is very mature on Windows platforms (in particular 2.24). http://www.pygtk.org/
gtk模块称为PyGtk,用于 Gtk+2,在 Windows 平台(特别是 2.24)上非常成熟。http://www.pygtk.org/
What's the difference?
有什么不同?
- PyGObject has some scarse Windows support. PyGtk has great support for this OS.
- PyGObject is what is called a dynamic binding and PyGtk is a static one.
- PyGObject is new and the future and PyGtk is the past, mature and some day will be deprecated.
- PyGObject documentation and examples are very very limited, and PyGtk one are very very complete: http://developer.gnome.org/pygtk/stable/
- They are not compatible, you can't use both and you need to choose one.
- PyGObject is in active development, no new features will be introduced for PyGtk.
- If you use Glade, the lastest version will be for PyGObject (for example 3.12.1). If you want to use Glade for PyGtk install the 3.8.0 version.
- PyGObject 对 Windows 的支持很少。PyGtk 对这个操作系统有很大的支持。
- PyGObject 是所谓的动态绑定,而 PyGtk 是静态绑定。
- PyGObject 是新的和未来的,而 PyGtk 是过去的,成熟的,总有一天会被弃用。
- PyGObject 文档和示例非常非常有限,而 PyGtk 一个非常非常完整:http: //developer.gnome.org/pygtk/stable/
- 它们不兼容,您不能同时使用两者,您需要选择一个。
- PyGObject 正在积极开发中,不会为 PyGtk 引入新功能。
- 如果您使用 Glade,则最新版本将用于 PyGObject(例如 3.12.1)。如果您想将 Glade 用于 PyGtk,请安装 3.8.0 版本。
If you choose to go PyGtk there is great support for freezing the application. You can check my documentation and support files for my application here: http://sourceforge.net/p/nestededitor/code/247/tree/trunk/dist/windows/
如果您选择使用 PyGtk,则可以很好地支持冻结应用程序。您可以在此处查看我的应用程序的文档和支持文件:http: //sourceforge.net/p/nestededitor/code/247/tree/trunk/dist/windows/
Hope it helps.
希望能帮助到你。
EDIT:
编辑:
Many things have changed in two years. Please see gianmt answer.
两年间,很多事情都变了。请参阅 giamt 答案。
回答by gianmt
Most of Havok answer is correct, except that documentation has been improved a lot lately, with a Tutorial:
Havok 的大部分答案都是正确的,除了文档最近有了很大改进,还有一个教程:
Including a PDF version for offline reading:
包括用于离线阅读的 PDF 版本:
And a complete API reference manual, not only of Gtk but also many other libraries that you can use with introspection:
还有一个完整的 API 参考手册,不仅是 Gtk 的,还有许多其他可以用于内省的库:
on windows the support is great, a lot of effort has been put in creating all the windows executables and libraries, the last release of pygi-aio is 3.10.6:
在 windows 上支持很好,在创建所有 windows 可执行文件和库方面付出了很多努力,pygi-aio 的最新版本是 3.10.6:
I've also put instructions on the Gnome wiki on how to build on win32 with pygobject introspection, it's not that hard, I've also uploaded a setup.py that actually works:
我还在 Gnome wiki 上发布了有关如何使用 pygobject introspection 在 win32 上构建的说明,这并不难,我还上传了一个实际有效的 setup.py:
So the answer is, don't go with PyGTK
所以答案是,不要使用 PyGTK

