Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyQt QPushButton colour

Writing in Python 2.7 using pyQt 4.8.5: What is the default background colour of a pyQt QPushButton widget? I am able to set the colour green but not return it to the default colour. A snap shot of what I mean:

enter image description here

The function responsbile for this:

def StartTransmit(self):
        self.ui.Transmit.setStyleSheet("background-color: green")**
        # self.ui.Transmit.setStyleSheet("background-color: DEFAULT <later on>")
        self.number = random.randint(1,10)
        self.ui.lcd.display(self.number)
        self.timer.start(1000)
like image 260
Harry Lime Avatar asked Oct 16 '25 10:10

Harry Lime


1 Answers

The answer is 'light gray', example:

def StartTransmit(self):
    self.ui.Transmit.setStyleSheet("background-color: green")
    self.timer.start(1000)

def StopTransmit(self):
    self.ui.Transmit.setStyleSheet("background-color: light gray")
    self.timer.stop()
like image 129
Harry Lime Avatar answered Oct 18 '25 21:10

Harry Lime