On Thu, Jun 05, 2003 at 04:17:43PM +0000, Jean-Baptiste Cazier wrote:
> Saell !
>
>
> When I try to run my program in the background with '&', it just stops.
> If I run it directly there is no problem, but otherwise I need to restart it
> manually:
>
> ~ $ devel/queue/queue.py
> Queue will refresh every 60 seconds
> ~ $ devel/queue/queue.py &
> [2] 21046
> ~ $
>
> [2]+ Stopped devel/queue/queue.py
> ~ $ fg
> devel/queue/queue.py
> Queue will refresh every 60 seconds
Two issues:
a) Does your timeout handler (Refresh) return gtk.TRUE?
b) Does your timeout handler read or write to stdin/stdout/stderr?
If your handler wants an interactive console (do a vi & to see what
I mean) it won't run when backgrounded unless you redirect those fds.
> Is is a python specific problem or for pygtk only or even just my program design ?
Your program design, I think, because the following script worksforme
when run &ed:
import gtk
import sys
class ShowQueue:
def __init__(self):
self.win = gtk.GtkWindow()
def Refresh(self, *args):
print "REFRESH"
return gtk.TRUE
def main():
queue=ShowQueue()
queue.win.show()
if len(sys.argv)!=1:
t=int(sys.argv[1])*1000
else:
t=60000
print "Queue will refresh every ",t/1000," seconds"
gtk.timeout_add(t,queue.Refresh)
gtk.mainloop()
return 1
if __name__ =="__main__":
main()
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/