Skip to content
Advertisement

Porting my PyGtk 3 app to Win32

I recently made my first app with pygtk using Anjuta. It works well under Linux, so it’s time to share it with relatives and friends. I installed Python, pygtk and the Gtk all-in-one bundle (Cairo, pyGobject ect) on windows and tried to run it.

I had an error saying self.builder.add_from_file(UI_FILE)

Digging a bit in the code I found out that my UI_FILE contains

<!-- interface-requires gtk+ 3.0 -->

And my python console says:

>>> import gtk
>>> gtk.gtk_version
(2, 22, 1)

As far as I know I installed the latest version of Gtk on my win32 machine. Now I don’t know how to tackle the problem: re-designing the interface to be compatible with gtk2.22.1? (then how?) using a cross compiler from my linux distro? (at what cost in complexity/stability?)

Thank you for your time, and you answers.

Advertisement

Answer

Remove all the widgets from your interface that are not compatible with GTK 2 (such as Grid, Overlay, etc.) If you have a Glade version from the 3.8 series I think you can automatically check which widgets are appropriate by going to the project properties and selecting GTK 2.24 as the target version. Then there is a button called “Verify widget versions and deprecations” that you can click to make sure that all the widgets you are using work with that version.

By the way, 2.22.1 is definitely not the latest version for Windows. It’s 2.24.7 or .8.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement