Created
October 26, 2021 06:40
-
-
Save PaulleDemon/f25c7629a711c4b00f5e9d5a441400b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import QApplication, QLabel | |
from PyQt5.QtGui import QFont, QPalette, QColor | |
if __name__ == '__main__': | |
app = QApplication(sys.argv) | |
label = QLabel("hello") | |
label.setFont(QFont("Times new roman", 20)) # change font size, setFont expects an instance of QFont(font_family, Font-size) | |
widget_palette = QPalette() | |
widget_palette.setColor(QPalette.Window, QColor("red")) | |
widget_palette.setColor(QPalette.WindowText, QColor("#00ff00")) | |
label.setPalette(widget_palette) | |
label.show() | |
sys.exit(app.exec()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment