[pygtk] gtk.MessageDialog doesn't work on windows
Frédéric
frederic.mantegazza at gbiloba.org
Thu Oct 23 18:25:04 WST 2008
Le 23/10/2008, "Timo" <timovwb at gmail.com> a écrit:
>The getLink() from above does indeed get called from within a thread,
>not the main loop. Would this be the problem?
Yes, no doubt!
>Because, in the same
>thread, I'm also moving a progressbar and filling up a treeview, and
>they seem to work fine.
Well,
First, you need to init the threads, at the begin of your program:
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
and call:
gtk.gdk.threads_leave()
at the end (not really needed).
Then, use a serializer. I attached mine. When you need to call a GUI
stuff from your thread, use:
ret = serializer.apply(<func>, <param1>, <param2>...)
This will push the <func> on a queue (note that you can wait for a return
value if needed). To have the queue executed, you need to call:
gobject.timeout_add(50, serializer.processWork)
before the gtk main loop. So, the serializer queue will be checked every
50 ms (try different values depending of your config).
Hope this helps.
--
Frédéric
-------------- section suivante --------------
Une pi?ce jointe non texte a ?t? nettoy?e...
Nom: serializer.py
Type: text/x-python
Taille: 3337 octets
Desc: non disponible
Url: http://www.daa.com.au/pipermail/pygtk/attachments/20081023/8a631d6b/attachment-0001.py
More information about the pygtk
mailing list