I have an app that makes a call to commands.getstatusoutput(...) and the system call (dd to image a drive) takes a LONG time. Obviously this is blocking any/all GTK calls and the window never gets refreshed so the user things that the app froze and then closes it.
Hi Christopher, as you know the problem is that getstatusoutput blocks the event loop. You have basically two options. 1) use threads 2) use nonblocking i/o. I'm not a fan of threads for pygtk apps so I'll explain 2. Use the subprocess module to open a pipe to the child. Set the pipe to nonblocking (fcntl module) Use gobject.io_add_watch to register a callback whenever there is data available Depending on what you're reading, you may accumulate the input or process it bit by bit. Good luck, Stephen. _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
