I want to create some GTK+2 applications using Python 3. I searched many places, but can only find tutorials for using GTK+2 together with Python 2, using PyGtk, or GTK+3 together with Python 3, using PyGobject. Is there any way to create GTK+2 applications using Python 3?
-
Looks like not: "PyGObject is a Python module that enables developers to access GObject-based libraries such as GTK+ within Python. It exclusively supports GTK+ version 3 or later. If you want to use GTK+ 2 in your application, use PyGTK, instead." (python-gtk-3-tutorial.readthedocs.org/en/latest/install.html)jonrsharpe– jonrsharpe2014-12-18 09:22:14 +00:00Commented Dec 18, 2014 at 9:22
Add a comment
|
1 Answer
Technically, it is possible, but not advisable.
If you compile GTK 2.24 yourself with GObject introspection turned on, and don't have GTK 3.x installed, then you should be able to use from gi.repository import Gtk to access the GTK 2 API.
However, this is not supported in any way, and even prints out a warning message to that effect. I don't even know if it still works. Even if it does work, it's still a bad idea; if your application only works on an unsupported configuration like this, then how are you going to distribute it?