[Tutor] threading problem in GUI

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Tue Sep 6 19:05:33 CEST 2005



nephish a écrit :
> Pierre Barbier de Reuille wrote:
> 
> [...]
> ok, i am still having a little problem understanding.
> tried it but i don't know if i have things set in the right order.
> 
> 
> gtk.gdk.threads_init()
> # Here initialize what you want
> [...]
> # Launch the Gtk loop
> gtk.gdk.threads_enter() # Unneeded if you don't want to call GUI
>                        # functions from other threads
> gtk.main()
> gtk.gdk.threads_leave() # Needed only with threads_enter
> 
> at the part where you wrote # Here initialize what you want
> [...]
> is that where i define the function that will run the thread?
> 
> i get the part about having the enter and leave
> i just seem to have a hang up (so to speak) with where the function gets
> defined.
> do i need to build it as a class like the example in the link you sent?

Well, no you don't need to create a class.

As for the place where to put your function, it's not a problem, [...]
is the place where you will *execute* some initialization code (if
needed) before you launch your interface. That's all (typically that's
where you will instanciate your widgets).

> 
> thanks for your help on this
> 
Your welcome,

Pierre

-- 
Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68


More information about the Tutor mailing list