[PyQt] os.popen output to a progress bar
Mark Summerfield
mark at qtrac.eu
Fri Mar 21 07:43:24 GMT 2008
On 2008-03-20, Jeremiah Summers wrote:
> 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.
Have you tried
self.ui.CHNGSPBar.setValue(int(per))
--
Mark Summerfield, Qtrac Ltd., www.qtrac.eu
More information about the PyQt
mailing list