[PyQt] os.popen output to a progress bar

Jeremiah Summers jmiahman at gmail.com
Thu Mar 20 23:15:29 GMT 2008


Hello Guys sorry to bother you again. You've just been a great help in
the past. Here's my issue. I'm trying to run a df command parse the
percentage and then output that to a progress bar. Here's my current
code:

def CHNGRefresh(self):
	per = os.popen("df /initrd/changes/|/bin/grep -o '.[0-99]%'|grep -o
'.[0-99]'").read()
	print (per)
	self.ui.CHNGSPBar.setValue(per)

You can tell by no means am I advanced I'm sure. That's why I'm asking
for help. I keep getting this error:
bash-3.1$ python space.py
65

Traceback (most recent call last):
  File "space.py", line 21, in CHNGRefresh
    self.ui.CHNGSPBar.setValue(per)
TypeError: argument 1 of QProgressBar.setValue() has an invalid type

I know setValue has to be an integer but I'm not sure how to make the
output a integer or something it will take. Thanks in advance.

Jeremiah


More information about the PyQt mailing list