37

I'm looking for a gi.repository module documentation and I can't find anything on the internet. All I found is documentation of new Gtk3 libraries for C, or old PyGtk 2.0 Reference Manual

I'm looking for something like PyGtk 2.0 Reference Manual but for Gtk3.

Is there something similar for Python? (I'm not looking for dir(Gtk) or help(Gtk) in the Python console.)

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
Jan Vorcak
  • 19,261
  • 14
  • 54
  • 90

5 Answers5

33

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/

The one specifically for GTK is: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

I hope you find these links helpful

liberforce
  • 11,189
  • 37
  • 48
Yomi
  • 351
  • 3
  • 4
  • 5
    Thanks! :) Link is working and the documentation is perfect! And IMHO this should be the accepted answer, as this is not a tutorial but a complete API reference. – endorama Aug 05 '14 at 14:50
  • Unfortunately libide is completely missing. Otherwise: great API documentation! For everyone searching an API documentation for writing gnome-builder extensions. Have a look in the c header files located at /usr/include/gnome-builder/libide/ (or similar, given that you have builder installed). Alternatively have a look In the source: https://git.gnome.org/browse/gnome-builder/tree/src/libide This really helped me a lot as the tutorial linked on the official site is anything but verbose. – Scindix Dec 09 '17 at 23:22
21

I think you're looking for this.

It's a work in progress, but basically is a tutorial for Gtk3 in python. 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.

jcollado
  • 39,419
  • 8
  • 102
  • 133
6

Generally speaking, you should be able to use the C library documentation as your main reference. The naming conversions between the C functions and their Python versions are quite consistent, so it's straight-forward in most cases. I would not expect to see Python-specific Gtk-via-introspection documentation.

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. 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.

4

Currently the gi-documentation for python is in development. It will appear in gtk3.4 or later.

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.

Michael Mrozek
  • 169,610
  • 28
  • 168
  • 175
Mic92
  • 1,298
  • 15
  • 13
2

Give a look at the GNOME Wiki, most of the useful information on Gobject Introspection is there:

liberforce
  • 11,189
  • 37
  • 48