[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] os.popen output to a progress bar
From:       Mark Summerfield <mark () qtrac ! eu>
Date:       2008-03-21 7:43:24
Message-ID: 200803210743.24461.mark () qtrac ! eu
[Download RAW message or body]

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

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic