I'm developing a simple application with PyGTK. I have a button which runs a subprocess in ubuntu when it clicked. I want to change status bar once exactly after the button clicked, and once when the subprocess finished. But at the moment it doesn't work fine, because it waits for subprocess to be finished, and then only changes the status bar to "Done". My code is something like this now:
def on_button_clicked(self, widget):
self.statusBar.push(1, "Doing the subprocess...")
command = '...'
print subprocess.call(command,shell=True)
...
self.statusBar.push(1, "Done!")
I thought I can change the status bar in another function and then call a function to do the rest, but it didn't work (and it sounds silly!). How should I change my code to show "Doing the subprocess..." status while the command is running in background?