On Mon, 2004-03-15 at 14:46, aviad cohen wrote:
> good day to you all
> i've created several windows wich are all
> connected togetrer and got myself a small
> GUI Program
> my problem is that now i want to add a function
> that would be called every 2 seconds and compute
> some thing, without interfering the main program.
> i thought about threading or maybe fork but i do belive there is a 
> simpler option

Have you tried timeout_add()?  I use 0.6 so I don't know if the API has
changed or not. These two FAQ entries should help you.

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq20.005.htp
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq20.007.htp


> i need to write something like:
> 
> .....
> class show_windows:
> .......
> class Worker(threading.Thread):
>     def __init__ (self):
>         threading.Thread.__init__(self)
>     def run (self):
>         while 1:           
>             do some callculations      
>             time.sleep(2)
> 
> def main ():
>    worker = Worker()
>    worker.start()
>    hello=show_windows()
>    gtk.mainloop()
> 
> if __name__ == "__main__":
>    main()
> 
> i wrote this small class and putted it in the main()
> but when the windows are loading
> it doesn't print "hello"
> when i close the window it's continuing
> 
> 
> thanks aviad
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure <[EMAIL PROTECTED]>
Racemi, Inc.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to