Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can one use Clutter with Python 3?

Are there Python 3 bindings for Clutter? If so, how can I get them and use them?

like image 890
argentpepper Avatar asked Dec 04 '11 23:12

argentpepper


2 Answers

As stated by Lattyware, the way to use Clutter in Python 3 is by installing "GObject introspection" data and allowing GObject to dynamically generate the bindings to the original C library.

On Ubuntu 11.10, install both Python 3 GObject and the GObject introspection data for clutter:

sudo apt-get install python3-gobject gir1.2-clutter-1.0

On Ubuntu 12.04 and later, the python3-gobject package has been renamed to python3-gi:

sudo apt-get install python3-gi gir1.2-clutter-1.0

If you want to install the GTK+ Clutter library:

sudo apt-get install python3-gi gir1.2-gtkclutter-1.0

If using a virtualenv virtual Python environment, use the following command, which allows Python to find the GObject introspection libraries:

virtualenv env -p python3 --system-site-packages

To use Clutter or GtkClutter in Python 3:

from gi.repository import Clutter
from gi.repository import GtkClutter

The package gi.repository is a special package which dynamically generates these Python classes.

like image 101
argentpepper Avatar answered Sep 18 '22 10:09

argentpepper


From what I gather, the answer is to use GObject rather than direct bindings, and PyGObject appears to have a Python 3 branch that apparently works - not that I have used it personally.

You might also want to see this question on using PyGObject with python 3.

like image 34
Gareth Latty Avatar answered Sep 19 '22 10:09

Gareth Latty