Re: [pygtk] periodically perform an action

2004-10-12 Thread Erik Grinaker
Martijn Brouwer wrote:
I would like to have my pygtk program call a function once every xx
seconds. My purpose is to update some information, say, every 30
seconds. In an plain python program I would call sleep(xx) between the
function calls. Since I am new to programming in event driven
interfaces, I do not know to do this in a gtk interface.
I guess, the gtk.mainloop has to take care for calling my function. How
do I achieve this.
You can set a function to be called at regular intervals with 
gobject.timeout_add()

http://www.pygtk.org/pygtk2reference/gobject-functions.html#function-gobject--timeout-add
Make sure your callback (the function to be called) returns TRUE, 
otherwise it will be removed from the timeout list.

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


Re: [pygtk] periodically perform an action

2004-10-12 Thread Christian Robottom Reis
On Tue, Oct 12, 2004 at 08:16:53PM +0200, Martijn Brouwer wrote:
 I would like to have my pygtk program call a function once every xx
 seconds. My purpose is to update some information, say, every 30
 seconds. In an plain python program I would call sleep(xx) between the
 function calls. Since I am new to programming in event driven
 interfaces, I do not know to do this in a gtk interface.
 I guess, the gtk.mainloop has to take care for calling my function. How
 do I achieve this.

Read the FAQ:

http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq20.007.htp

I should rewrite the title or add a new FAQ for your specific question,
though.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] periodically perform an action

2004-10-12 Thread Jonathan Brandmeyer
On Tue, 2004-10-12 at 14:16, Martijn Brouwer wrote:
 Hi,
 I would like to have my pygtk program call a function once every xx
 seconds. My purpose is to update some information, say, every 30
 seconds. In an plain python program I would call sleep(xx) between the
 function calls. Since I am new to programming in event driven
 interfaces, I do not know to do this in a gtk interface.
 I guess, the gtk.mainloop has to take care for calling my function. How
 do I achieve this.

See gtk.timeout_add().

HTH,
-Jonathan Brandmeyer

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