# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from my_app_ui import Ui_Form
class MyWindow(QWidget, Ui_Form): # Inheritance exactly in this sequence
def __init__(self, *args, **kwargs):
super(MyWindow, self).__init__(*args, **kwargs)
self.setupUi(self)
# -== Signals ==-
self.btn_click.clicked.connect(self.click_me)
self.show()
# -== event handlers aka Slots ==-
def click_me(self):
my_text = self.lineEdit.text()
self.label.setText(my_text)
if __name__ == "__main__":
app = QApplication(sys.argv) # or QApplication([])
win = MyWindow()
sys.exit(app.exec()) # or simply app.exec() or app.exec_()
Last active
February 21, 2022 14:09
-
-
Save jigi-33/f8c947645b1036d579e953805c553f18 to your computer and use it in GitHub Desktop.
Рыба (эталон) главного скрипта при подключении внешнего UI, сгенеренного QtDesigner'ом
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternative way: