I'm trying to build a simple gui for a video converter application called "HandBrake" using PyQt.
My problem is that when I choose a video file to convert, subprocess Popen starts handbrake application with the necessary args but while waiting for handbrake to finish the gui gets blocked so I can't do any changes. (Ex: I can't disable the pushButton nor change its text)
I'm not looking for a more complicated solution such as progressbar etc. but I'd like to simply disable the button and change its text while waiting for the program to finish converting.
How can I do such thing with python & pyqt?
def videoProcess():
self.pushButton.setEnabled(0)
self.pushButton.setText("Please Wait")
command = "handbrake.exe -i somefile.wmv -o somefile.mp4"
p = subprocess.Popen(str(command), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while 1:
line = p.stdout.readline()
if not line:
self.pushButton.setEnabled(1)
break