If the GUI does not need user interaction during the expensive process then there's no reason it can't be in the main thread. You can still update the UI (repaint, handle moving/sizing the window, etc.) manually in your loop
- Disable the widget by setting it's
"sensitive"
property to False.widget.set_sensitive(False)
- During each iteration (or every
n
iteraions) of your processing loop, update the UI with:while gtk.events_pending(): gtk.main_iteration()
.
If you are going to use threads, the comment from ergosys with the link to the PyGTK F.A.Q. should help. You should also read Threads in the GTK+ Reference Documentation.