I have been trying to find out which the right syntax for the .setFormat() method of the ProgressBar is, but i cannot find any information about that. %p% just shows the percentage as '34%' but I would like to display fractions as well like this: '33.7%'.
Yes you can simply add self.pbar.setFormat('%.02f%%' % (self.step))
with your code
and if you want to implemnt more precise formating you can re implement QProgressbar like this maybe
class qProress(QtGui.QProgressBar):
"""docstring for qProress"""
def __init__(self,args):
super(qProress, self).__init__(args)
self.valueChanged.connect(self.onValueChanged)
def onValueChanged(self, value):
self.setFormat('%.02f%%' % (self.prefixFloat))
def setValue(self, value):
self.prefixFloat = value
QtGui.QProgressBar.setValue(self, int(value))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With