Python ImportError:无法导入名称GdkX11

Python ImportError:无法导入名称GdkX11,python,gtk3,pygobject,Python,Gtk3,Pygobject,我是一名Windows开发人员,正在尝试启动PyGTK开发。我想从GTK+3开始,然后是这个 我的环境: Windows 7 64位 Python 3.2 32位 我的代码: 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

我是一名Windows开发人员,正在尝试启动PyGTK开发。我想从GTK+3开始,然后是这个

我的环境:

  • Windows 7 64位
  • Python 3.2 32位
我的代码:

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
错误:root:找不到GdkX11的任何类型库
回溯(最近一次呼叫最后一次):
文件“C:\Program Files(x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py”,第1534行,在
运行(安装程序['file'],无,无)
文件“C:\Program Files(x86)\JetBrains\PyCharm 3.1\helpers\pydev\pydevd.py”,第1145行,正在运行
pydev_imports.execfile(文件、全局、局部)#执行脚本
文件“C:\Program Files(x86)\JetBrains\PyCharm 3.1\helpers\pydev\\u pydev\u execfile.py”,第37行,在execfile中
exec(compile(contents+“\n”,file,'exec'),glob,loc)#执行脚本
文件“Z:/git.repositories/gourmet frontend/python/gourmet/main_gtk3.py”,第27行,在
从gi.repository导入GdkX11
ImportError:无法导入名称GdkX11

安装时,我选择所有选项并选中以降级到GTK+3.8.9。

GdkX11
是一个平台相关库,仅在X11平台上可用(顾名思义)。您在Windows上找不到它,您必须更换它。

谢谢。但在Windows环境中,我可以使用什么替换来获取XID属性呢?我正在尝试一个需要窗口整数id的端口代码。我没有为PyGI库找到解决方案。GTK+2中存在GtkWindow对象的Handle属性。我没有可用的Windows环境进行验证,但从源代码来看,我相信您可以使用
从gi.repository导入GdkWin32
GdkWin32.window\u get\u impl\u hwnd()
?有关详细信息,请参阅。当我尝试导入GdkWin32时,出现以下错误:ImportError:无法导入名称GdkWin32