PyGtk 程序在 Windows 上没有响应
我刚刚设法让 py2exe 在 Windows 虚拟机上工作,但在该计算机上安装 GTK、Pango、Gobject 等后偶然发现了另一个问题:当我启动 Python 脚本时,窗口会出现,但它立即出现停止响应。如果我打开 python 解释器并输入:
import gtk
w = gtk.Window()
w.show()
我还不允许发布任何图像,但这里是屏幕截图的链接:https://i.sstatic.net/3RJ0n.png
这对我来说是一个问题,就好像我用 py2exe 创建一个可执行文件一样,当我执行该程序时,我会得到相同的结果。
感谢您的帮助以及您花时间帮助我! :)
解决了!看来以 Windows Xp Service Pack 2 的兼容模式以管理员身份安装 ActivePython、安装 GTK 运行时、PyCairo、PyObject、PyGtk 解决了问题。感谢adw的帮助和建议!
I just managed to get py2exe work on a Windows Virtual Machine but stumbled on another problem which I didn't have right after I installed GTK, Pango, Gobject etc. on that machine: When I launch a Python Script the window appears but it immediately stops responding. This happens too if I open a python interpreter and type:
import gtk
w = gtk.Window()
w.show()
I'm not allowed to post any images yet, but here's the link to a screenshot: https://i.sstatic.net/3RJ0n.png
This is a problem for me, as if I create an executable with py2exe I get the same result when I execute the program.
Thank you for your help and for your time spent to help me! :)
Solved! It seems installing ActivePython the installing GTK runtime, PyCairo, PyObject, PyGtk as administrator with compatibility mode for Windows Xp Service Pack 2 solved the problem. Thank you adw for your help and suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要运行一个主循环,以便 GTK 可以处理事件、在窗口中绘制等。
将其添加到您的程序中:
另请参阅:http://live.gnome.org/PyGTK/QuickStart
You need to run a main loop so GTK can process events, draw in the window, etc.
Add this to your program:
See also: http://live.gnome.org/PyGTK/QuickStart
解决了!看来以 Windows Xp Service Pack 2 的兼容模式以管理员身份安装 ActivePython、安装 GTK 运行时、PyCairo、PyObject、PyGtk 解决了问题。感谢adw的帮助和建议!
Solved! It seems installing ActivePython the installing GTK runtime, PyCairo, PyObject, PyGtk as administrator with compatibility mode for Windows Xp Service Pack 2 solved the problem. Thank you adw for your help and suggestions!