I'm trying to get gtk.ProgressBar.set_text('Text')
to work when I click on a button, prior to launch my subprocess
.
Here is my code (full source here):
def on_button_clicked(self, button, progress_bar, filename):
self.execute(progress_bar, filename)
def execute(self, progress_bar, filename):
progress_bar.set_text('Encoding')
progress_bar.pulse()
cmd = ['ffmpeg', '-y',
'-i', filename,
'-r', '30',
'/tmp/test-encode.mkv']
process = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
process.wait()
progress_bar.set_text('Done')
I tried moving progress_bar.set_text('Encoding')
in on_button_clicked()
but it doesn't change anything: I click the button, the job is done (the file is duly produced and OK) and only then the progress bar says "Done".
I did my homework and read all related questions, but they either don't use subprocess, or parse "regular" command outputs.