PyGtk Program is not responding on Windows

强颜欢笑 提交于 2019-12-11 05:07:42

问题


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: http://i.stack.imgur.com/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!


回答1:


You need to run a main loop so GTK can process events, draw in the window, etc.

Add this to your program:

gtk.main()

See also: http://live.gnome.org/PyGTK/QuickStart




回答2:


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!



来源:https://stackoverflow.com/questions/4009566/pygtk-program-is-not-responding-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!