Skip to content

Instantly share code, notes, and snippets.

@PaulleDemon
Created October 26, 2021 06:40
Show Gist options
  • Save PaulleDemon/f25c7629a711c4b00f5e9d5a441400b5 to your computer and use it in GitHub Desktop.
Save PaulleDemon/f25c7629a711c4b00f5e9d5a441400b5 to your computer and use it in GitHub Desktop.
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