Are there Python 3 bindings for Clutter? If so, how can I get them and use them?
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.
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.
© 2022 - 2024 — McMap. All rights reserved.