Marco Islas Blog




PyGTK y Threads

Es facil, al inicio de tu aplicacion tendras que inicializar los threads, que son algo asi:
gtk.gdk.threads_init()
 
Esto lo tendras que hacer antes de iniciar algun thread. Y luego, al usar algun thread debes englobarlo dentro de
gtk.threads_enter()
thread.start_new(funcion, (arg1,arg2,argN))
gtk.threads_leave()
 
Solo recuerda que no debes manipular gtk fuera del thread en el que esta corriendo el ciclo principal (gtk.main_loop).
Si lo que necesitas es estar cachando informacion en un thread aparte y modificar la interfaz (ej. Leyendo un socket y mostrando informacion de cuanto llevas leido) entonces usa alguna bandera y modifica tu apariencia en el thread principal, de lo contrario tendras problemas con gobject y glib.

Leave a Comment

Write the captcha code you are seeing.

Comment XML feeds: RSS | Atom




twitter logo




Recent Comments On Blog

avatar
Marco Antonio Islas Cruz on
 
avatar
Marco Antonio Islas Cruz on
 
avatar
Marco Antonio Islas Cruz on
 Getting ready
avatar
Marco Antonio Islas Cruz on
 Python: Create win32 services using Python and py2exe
avatar
jopython@gmail.com on
 Python: Create win32 services using Python and py2exe
avatar
yodenuevo on
 Holy Shit!
avatar
markuz on
 Holy Shit!
avatar
yo on
 Holy Shit!
avatar
Gustavo on
 Things that happen last week
avatar
Marco Antonio Islas Cruz on
 Christine: rola_christine.py