from PyQt4 import QtGui, QtCore DEFAULT_STYLE = """ QProgressBar{ border: 2px solid grey; border-radius: 5px; text-align: center } QProgressBar::chunk { background-color: lightblue; width: 10px; margin: 1px; } """ COMPLETED_STYLE = """ QProgressBar{ border: 2px solid grey; border-radius: 5px; text-align: center } QProgressBar::chunk { background-color: red; width: 10px; margin: 1px; } """ class MyProgressBar(QtGui.QProgressBar): def __init__(self, parent = None): QtGui.QProgressBar.__init__(self, parent) self.setStyleSheet(DEFAULT_STYLE) def setValue(self, value): QtGui.QProgressBar.setValue(self, value) if value == self.maximum(): self.setStyleSheet(COMPLETED_STYLE)