I have a pygtk program which starts a separate thread to receive HTTP request from user and display message dialogs by checking a string variable every 500 ms. It works well on Windows 7, but testing on Windows XP failed: the GUI blocked and no window is showed.
Gradually I found gobject.timeout_add() function is not working, in fact, it didn't work after calling gtk.threads_init().I reduced unrelated code and got following simplest situation to reproduce the issue.
Following simple code will hang forever on windows XP, and the "check dialog" text is never outputted to console. The window created in the code showed but is blocked (when I move mouse into the window area, the mouse pointer is always a "loading" icon)
123456789101112 import gtkimport gobjectdef checkDialog():print 'check dialog'return Truegobject.timeout_add(500, checkDialog)gtk.threads_init()w= gtk.Window()w.show()gtk.main()
If we remove gtk.threads_init(), code will work.
To solve this issue, just replace gtk.threads_init() with gobject.threads_init()