pythonpyqt5python-3.7

customized Qprogressbar in python qt


is it possible to develop a multicoloured progressbar? tried with gradient color but did not work. like the below progressbar using pyqt5.

enter image description here

enter image description here

code:

QProgressBar{
font: 2pt "Tw Cen MT Condensed Extra Bold";
padding: 0px;
border:None;    
color: qlineargradient( x1:0, y1:0, x2:1, y2:0, stop:0.181818 rgba(0, 74, 134, 255), stop:0.392045 rgba(0, 104, 181, 255), stop:0.619318 rgba(0, 163, 246, 255), stop:0.6875 rgba(0, 199, 253, 255));
}

Solution

  • worked by making color as background color. and added qprogressbar::chunk

    QProgressBar{
    font: 2pt "Tw Cen MT Condensed Extra Bold";
    padding: 0px;
    border:None;    
    }
    QProgressBar::chunk{
    background-color: qlineargradient( x1: 0, x2: 1, 
    stop:0 rgba(0, 74, 134, 255),stop:0.1 rgba(0, 74, 134, 255),
     stop:0.11 rgba(0, 104, 181, 255), stop:0.25 rgba(0, 104, 181, 255), 
    stop:0.26 rgba(0, 163, 246, 255), stop:0.5 rgba(0, 163, 246, 255), 
    stop:0.51 rgba(0, 199, 253, 255),stop:1 rgba(0, 199, 253, 255));
    }