简体   繁体   中英

Python3 and GTK3 on Windows

I am currently trying to use GTK3 and Python3 for GUI development.

Everything is working fine while doing this on my Ubuntu device, but as I want to be able to have Windows executables later, I need to set these tools up on Windows 7.

I have Python 3.4.4 (64 Bit) installed on my system and tried solutions from other posts on Stackoverflow to be able to use GTK with it, but I was not able to get it to work.

When trying to import Gtk ( import gi and from gi.repository import Gtk ) on the Python shell, the following error occurs:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\gi\importer.py", line 100, in find_module
    'introspection typelib not found' % namespace)
ImportError: cannot import name Gtk, introspection typelib not found

What I have installed at the moment:

Which is the best way to get a working set of Python3 and GTK3 on Windows? (As far as I have seen it is not possible to create Windows executables using Ubuntu.)

You need only to install Python 3.4 and the PyGObject project on sourceforge (the one you mentioned in your post). This setup must work on Windows, because it works for me.

Maybe you missed to check the Gtk3 libraries during installation of PyGObject (this is a frequent error).

You don't need msys2 at all to use PyGObject in Python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM