导入错误:无法导入名称 GdkX11
我是一名Windows开发者,想开始学习PyGTK开发。我想从GTK+3开始,参考这个文档。
我的环境配置:
- Windows 7 64位
- Python 3.2 32位
- pygi-aio-3.10.2-win32_rev18-setup.exe
我的代码:
from gi.repository import Gtk
from gi.repository import GdkX11
错误信息:
ERROR:root:Could not find any typelib for GdkX11
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 1534, in <module>
debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py", line 1145, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\pydev\_pydev_execfile.py", line 37, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
File "Z:/git.repositories/gourmet-frontend/python/gourmet/main_gtk3.py", line 27, in <module>
from gi.repository import GdkX11
ImportError: cannot import name GdkX11
在安装pygi-aio-3.10.2-win32_rev18-setup.exe时,我选择了所有选项,并勾选了降级到GTK+ 3.8.9。
1 个回答
2
GdkX11
是一个依赖于特定平台的库,顾名思义,它只在 X11 平台上可用。也就是说,你在 Windows 系统上找不到它,需要使用其他的替代方案。