简体   繁体   English

是否有python的gi.repository文档?

[英]Is there a gi.repository documentation for python?

I'm looking for a gi.repository module documentation and I can't find anything on the internet. 我正在寻找gi.repository模块文档,但在Internet上找不到任何内容。 All I found is documentation of new Gtk3 libraries for C, or old PyGtk 2.0 Reference Manual 我发现的只是用于C的新Gtk3库或旧的PyGtk 2.0参考手册的文档。

I'm looking for something like PyGtk 2.0 Reference Manual but for Gtk3. 我正在寻找类似PyGtk 2.0参考手册的内容,但适用于Gtk3。

Is there something similar for Python? Python有类似的东西吗? (I'm not looking for dir(Gtk) or help(Gtk) in the Python console.) (我不是在Python控制台中寻找dir(Gtk)help(Gtk) 。)

Yes, I found a site that contains documentations for all python bindings of perhaps all GNOME projects that are supported by the python gi.repository module or the Python GObject Introspection module: http://lazka.github.io/pgi-docs/ 是的,我找到了一个站点,其中包含python gi.repository模块或Python GObject Introspection模块支持的所有GNOME项目的所有python绑定的文档: http ://lazka.github.io/pgi-docs/

The one specifically for GTK is: http://lazka.github.io/pgi-docs/Gtk-3.0/index.html 专门用于GTK的是: http : //lazka.github.io/pgi-docs/Gtk-3.0/index.html

There is also documentation specific to the gi package provided by PyGObject: https://pygobject.readthedocs.io/en/latest/guide/api/api.html 还有一些特定于PyGObject提供的gi包的文档: https ://pygobject.readthedocs.io/en/latest/guide/api/api.html

I hope you find these links helpful 希望这些链接对您有所帮助

I think you're looking for this . 我认为您正在寻找这个

It's a work in progress, but basically is a tutorial for Gtk3 in python. 这是一个正在进行的工作,但基本上是python中的Gtk3教程。 I doesn't really cover any other thing aside from Gtk widgets (so no Glib, for example), but it's still useful to get started. 除了Gtk小部件(例如,没有Glib)之外,我实际上没有介绍其他任何东西,但是入门仍然很有用。

Generally speaking, you should be able to use the C library documentation as your main reference. 一般来说,您应该可以使用C库文档作为主要参考。 The naming conversions between the C functions and their Python versions are quite consistent, so it's straight-forward in most cases. C函数和它们的Python版本之间的命名转换非常一致,因此在大多数情况下很简单。 I would not expect to see Python-specific Gtk-via-introspection documentation. 我不希望看到特定于Python的Gtk-via-introspection文档。

I occasionally had trouble finding, for example, constants at first. 一开始我偶尔会遇到一些麻烦,例如常量。 In this case, using iPython's tab-completion to search the Gtk, Gdk and Gobject namespaces was invaluable. 在这种情况下,使用iPython的制表符补全来搜索Gtk,Gdk和Gobject命名空间非常有用。 There are a few rare cases in which introspection is impossible and, at least in the last version I was working with, they hadn't been manually implemented (can't remember exactly which functions), so there's not much you can do with those; 在少数情况下,无法进行内省,至少在我使用的上一个版本中,这些内省并不是手动实现的(无法确切记住哪个功能),因此对这些功能您无能为力; I had to dig into the gi.repository source to verify these cases. 我不得不深入研究gi.repository源以验证这些情况。

Currently the gi-documentation for python is in development. 目前python的gi文档正在开发中。 It will appear in gtk3.4 or later. 它将出现在gtk3.4或更高版本中。

You can currently either build it on your own , or use unofficial generated versions like here . 当前,您可以自己构建它 ,也可以使用此处生成的非官方版本。 But be careful, they can contain information from future versions. 但请注意,它们可能包含将来版本的信息。

Give a look at the GNOME Wiki, most of the useful information on Gobject Introspection is there: 看一下GNOME Wiki,有关Gobject自省的大多数有用信息都位于:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM