pyqt5 change button color
self.pushButton.setStyleSheet("background-color: red")
pyqt5 change button color
self.pushButton.setStyleSheet("background-color: red")
change color of text button pyqt5
setStyleSheet('QPushButton {background-color: #A3C1DA; color: red;}')
pyqt change button text color
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.init_me()
def init_me(self):
self.setGeometry(600, 250, 750, 500)
self.setStyleSheet("background:gray") <----
# or
# self.setStyleSheet("background:rgb(r:int,g:int,b:int)") <----
self.show()
# to change the color of the text: <----
# self.setStyleSheet("color:rgb(...)")
# or to change both at the same time:
# self.setStyleSheet("color: rgb(...);background: rgb(...)")
# you can do that with any QWidget object or class that inherits QWidget, <----
# eg. QPushButton, QLabel, ...
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us