gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

Todong Ma
Hi, everyone

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)

import gtk
import gobject

def checkDialog():
  print 'check dialog'
  return True

gobject.timeout_add(500, checkDialog)
gtk.threads_init()
w = gtk.Window()
w.show()
gtk.main()

While same code works well on Windows 7

Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone



_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Reply | Threaded
Open this post in threaded view
|

Re: gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

Skip Montanaro-3
Have you tried calling gtk.threads_init() before gobject.timeout_add(...)?

On Wed, Jun 26, 2013 at 5:56 AM, Todong Ma <[hidden email]> wrote:

> Hi, everyone
>
> 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)
>
> import gtk
> import gobject
>
> def checkDialog():
>   print 'check dialog'
>   return True
>
> gobject.timeout_add(500, checkDialog)
> gtk.threads_init()
> w = gtk.Window()
> w.show()
> gtk.main()
>
> While same code works well on Windows 7
>
> Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone
>
>
>
> _______________________________________________
> pygtk mailing list   [hidden email]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
Reply | Threaded
Open this post in threaded view
|

Re: gobject.timeout_add() won't work after calling gtk.threads_init() on windows xp

Todong Ma
In reply to this post by Todong Ma
On 2013/6/26 18:56, Todong Ma wrote:
Hi, everyone

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)

import gtk
import gobject

def checkDialog():
  print 'check dialog'
  return True

gobject.timeout_add(500, checkDialog)
gtk.threads_init()
w = gtk.Window()
w.show()
gtk.main()

While same code works well on Windows 7

Runtime details: Windows XP SP3, python 2.7.5, pytgtk-2.24-allinone


Just now Juhaz on the IRC channel told me I should try gtk.gdk.threads_init() or gobject.threads_init() instead of gtk.threads_init().
Then I tried them and found it works by using gobject.threads_init()!

Thank you all!

_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/