pyqt change button text color

Solutions on MaxInterview for pyqt change button text color by the best coders in the world

showing results for - "pyqt change button text color"
Beatrice
07 Jan 2017
1class Window(QMainWindow):
2    def __init__(self):
3        super().__init__()
4        self.init_me()
5
6    def init_me(self):
7        self.setGeometry(600, 250, 750, 500)
8        self.setStyleSheet("background:gray")  <----
9        # or
10        # self.setStyleSheet("background:rgb(r:int,g:int,b:int)")  <----
11
12        self.show()
13        
14# to change the color of the text:		<----
15# self.setStyleSheet("color:rgb(...)")
16# or to change both at the same time:
17# self.setStyleSheet("color: rgb(...);background: rgb(...)")
18# you can do that with any QWidget object or class that inherits QWidget, <----
19# eg. QPushButton, QLabel, ...