Using VSC with GTK3 and Python on Windows

Hello, this is my first post here.
Is anyone using VSC - Visual Studio Code - with Python 3.X and GTK3 libraries on windows ?
I am using MSYS2 GTK3 binaries and applications run fine but if I’m trying to run them inside VSC (or just in Windows PowerShell prompt ) I get this :

Exception has occurred: ImportError
DLL load failed while importing _gi: Impossibile trovare la procedura specificata.
File “C:\msys64\home\user\work\glade\kwp2000\kwploader.py”, line 3, in
from gi.repository import Gtk

The problem is in the place to search for dll …
The more general question could be: It is possible to run GTK3 python scripts from windows without Msys2 ?

1 Like

The gvsbuild build tool includes pygobject, and lets you build with Visual Studio.

Hi Emanuele,

I don’t have visual studio , usually I’m using msys2 and vim.
I just would like to use VSC as an IDE (editor + debugger), because this way I can visually debug python applications and get advantage of intellisense feature in VSC.

Yes, gedit does it. gedit is a C application with some plugins written in Python. The Python plugins work fine (except the Linux-specific ones, of course).

I’m not a Python expert though, I don’t know why your code doesn’t run outside msys2, the only thing that I can recommend is to look at the MSYS2/MINGW packages, there are maybe some simple Python/GTK3 apps that are packaged and available in MSYS2 (and there is gedit among them, but it’s probably not the easiest example to look at).

I tried QT for python, there’s a Windows distribution (pip3 install pyqt5) that is also installing qtdesigner, I would prefer to use gtk3 (or gtk4 when available) and glade, but I think I would need a Windows distribution (ie not using msys2).
Do you think it will be available in the near future?

No. We (GTK developers) don’t do binary builds for any platform, and leave things to downstreams. We barely have time to work on the toolkit itself, so doing packages for a bajillion different package managers is not something we can commit to.

Ok, just asking, of course I’m a little disappointed for this, because I’m a first time user of gtk - since 1.0 and very enthusiast about it and looking forward to use gtk on serious windows apllications development instead of qt.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.