First time here? Check out the FAQ!

Revision history  [back]

How can I run a PyGTK program in WingIDE?

I have a Python module that I used to be able to run from within WingIDE on Windows, that has the following GTK code in the header:

from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, Pango

But since I've gotten a new computer, I can't seem to get the PyGObject modules set up in my Python 3.8.10 installation, i.e. "import gi" and related commands don't work.

At https://pygobject.readthedocs.io/en/latest/getting_started.html it talks about installing msys2 to use pyGObject in Windows, and if I follow those instructions, I can indeed run the gtk4-demo module in the msys2 environment.

But how do I now run my module from within WingIDE? I assume that it has something to do with setting up a custom environment in the Project Properties, but I don't think I did that on my old computer - I think I somehow managed to install PyGObject in the main Python installation? (If you do a Google search, you can see that a lot of people have struggled with this, and there have been different solutions over time.) I haven't really done anything with custom environments before, so please be specific (and gentle... :-) in your reply.