Skip to content

Instantly share code, notes, and snippets.

@PaulleDemon
Created October 26, 2021 06:45
Show Gist options
  • Save PaulleDemon/b8ce76a4a2aeb03fb9656b8228c49b7a to your computer and use it in GitHub Desktop.
Save PaulleDemon/b8ce76a4a2aeb03fb9656b8228c49b7a to your computer and use it in GitHub Desktop.
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QVBoxLayout
def change_button_text():
button.setText("Button has been clicked")
if __name__ == '__main__':
app = QApplication(sys.argv)
widget = QWidget()
v_layout = QVBoxLayout()
label = QLabel("Sample label")
button = QPushButton("Button")
button.clicked.connect(change_button_text)
v_layout.addWidget(label)
v_layout.addWidget(button)
widget.setLayout(v_layout)
widget.show()
with open("theme.qss", "w") as f_obj:
theme = f_obj.read()
app.setStyleSheet(theme)
sys.exit(app.exec())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment