Created
October 26, 2021 06:45
-
-
Save PaulleDemon/b8ce76a4a2aeb03fb9656b8228c49b7a 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, 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