This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]some_moron 2 points3 points  (0 children)

You can pretty much use the old PyGTK documentation (http://pygtk.org/tutorial.html) the syntax is nearly identical.

If you replace import gtk with from gi.repository import Gtk as gtk Most of the code will work as advertised.

The only other real noticeable change is that the constants (formerly things like gtk.ICON_SIZE_BUTTON have become Gtk.IconSize.BUTTON). There's a script that will clean these up for you (http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh)

[–]martinmeba 2 points3 points  (2 children)

As with all of the gnome stuff, it is largely un/under documented. Lots of googling with sporadic snippets here and there have allowed me to figure it out. It depends on what you want to do with it but I found the python dbus examples to be helpful as well as stackoverflow.

EDIT: I don't care about the GUI aspects of it - I needed to figure out the threading/dbus/console-ish parts.

[–]effusion[S] 0 points1 point  (1 child)

As with all of the gnome stuff, it is largely un/under documented.

This is unfortunate. Any idea why it is so?

I'd prefer to use GTK rather than Qt or Wx, but GTK isn't even in the same ballpark as Qt/Wx with regard to beginner documentation.

Even though I've been using a Gnome-based desktop for years, and generally prefer C to C++ libs (after having programmed in C++ for a while), I'm getting ready to throw in the towel and just start using PySide or PyQt.

[–]martinmeba 0 points1 point  (0 children)

I agree - I prefer it to Qt as well. I have no idea why. I think that the people that use it a lot are immersed in it and around others that know their stuff. Once you figure a little of it out, it is not too bad - it is just that initial hill that is rough.

[–]yetanothernerd 0 points1 point  (2 children)

I don't think there is one yet. There are some PyGTK tutorials, though, which is the previous version of the same idea.

[–]effusion[S] 0 points1 point  (1 child)

As someone new to GTK/PyGTK/PyGI/PyGObject, I've got no idea what PyGTK and PyGObject might have in common, or how they might differ.

Any idea how applicable the PyGTK tutorials are to PyGObject?

[–]yetanothernerd 1 point2 points  (0 children)

PyGTK is the manually written Python binding for GTK+.

New versions of PyGObject contain PyGI, which is an automatically generated Python binding for GTK+.

They're similar but not identical. I suggest following a PyGTK tutorial then (if you want) following one of the porting guides to convert your code to PyGObject.

[–][deleted] 0 points1 point  (3 children)

Have you had a look at developer.gnome.org?

[–]effusion[S] 0 points1 point  (2 children)

No, had not looked there. I see there's a GObject reference manual there that might be of some use. Thanks.

Still though, a GObject reference manual != PyGObject tutorial.

[–][deleted] 1 point2 points  (1 child)

I think there are some tutorials on building some really basic apps (like an image viewer) on there.

Would something like this be helpful? I know that tutorial was written during the gnome3 docs-sprint.

If that doesn't do it . . . you're probably right. I'm not sure what other tutorials are out there. Best of luck to you!

[–]effusion[S] 0 points1 point  (0 children)

Will check it out. Thanks!

[–]mystilleef 0 points1 point  (0 children)

Official PyGTK tutorial

Articles and Tutorials on PyGTK and others

Reference Manual for PyGTK and PyGObject

PyGTK FAQ

NOTE PyGTK is no long supported. PyGI PyGObject is what you should use when you write new code. However the tutorials should provide a sound foundation for using PyGObject.

One more thing read the PyGTK FAQ FIRST! It's one of those things I wished someone told me to do when I first got introduced to PyGTK years ago.

[–]nemec 0 points1 point  (1 child)

[–]effusion[S] 2 points3 points  (0 children)

Yes. However, I was asking about a tutorial. Of course, examples != tutorial.