Computer :(

/home/rrix:blog:tags:cgit:rss

(Seemingly, the only) working Pyclutter examples.

So, I've been hacking for about 24 hours straight on getting a nice bit of code written for Fedora-tour using the Clutter UI toolkit, the toolkit used to program the new gnome-shell and some other fancy stuff. Unfortunately, I chose to use the python bindings for clutter, called, sensibly enough, pyclytter. ZOMG, we'll see if that was a mistake soon.

The first issue, which is strange to me still, and resulted in three posts at fedora-devel, with me answering my own issue, was that my python code was randomly segfaulting (I laugh when I see that) because it makes calls into a compiled, I assume, bridge library between the clutter libraries and the python bindings. OHFUN. So, after trying to get some useful debugging from it for about 18 of those 24 hours (six of the 18 were sleep, admittedly) I rebooted my system for upgrade purposes and lo and behold! my code works! Idk, either. LD fun? who knows, who cares? I've raged enough over it for two lifetimes :)

The second issue was the complete and total lack of pyclutter documentation and example code. PyClutter was packaged in Fedora, I'd assume for one application, the media-center application entertainer, which is broken with the [[https://bugzilla.redhat.com/show_bug.cgi?id=526035%5D%5Bversion of PyClutter we ship.] Oh dear.

On top of that, there are virtually no working examples of PyClutter on the internet, as far as I can tell. Google Code search lists two, which I've stuck here for good posterity:

ClutterMediator.py from coverartclutter

launcher-gtk.py from libchamplain

And the official docs.

There is also one hello world example that didn't work for the version of pyclutter that Fedora 12 ships.

So, I fixed it. This provides a quick crash course of a few different things to do in clutter. You can also, I learned, create a clutter stage embedded in a gtk.Window, which is freaking cool. The code is fairly simple to do it, and it's what Fedora-tour is doing:

#add the embedded clutter canvas to the gtk window self.embed =
cluttergtk.Embed() self.mainWindow.add(self.embed) self.embed.show()

#realize the object and get the Clutter stage.  self.embed.realize() windowSize
= self.mainWindow.get_size()
self.embed.set_size_request(windowSize[0],windowSize[1]) stage =
self.embed.get_stage()

At which point you have a clutter stage you can do whatever with. Enjoy. :) Clutter is a really nice toolkit, and the python bindings make code quick and easy. Fedora-tour is going to have some cool dynamic introduction scenes. :-) It's just too bad there isn't more easy to use code out there in the wild.