Reputation: 687
Basically I want to do this:
when the user presses a button, the application should open a dialog with a spinner inside of it, while some tasks are executed in background. When this tasks are finished, this dialog should be destroyed, and a new dialog should be opened.
I'm working with python and gtk
How can I do it? thanks!
Upvotes: 0
Views: 413
Reputation: 1328
Basically there are two ways. The difference is who is the "main" program. If you want gtk to be in charge, you just create your dialog, and set up an callback for use when idle (gobject.idle_add
). This job should make sure that it doesn't take long every step, so gtk can update the gui (you probably want gobject.timeout_add
for your spinner).
The other way is that your "background" job is in control. It can just do what it wants, it should just call gtk every now and then (while gtk.events_pending (): gtk.main_iteration (False)
) to make sure gtk can update the gui.
Upvotes: 2