Advertisement
Artim_Anton

som

May 18th, 2021
1,108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. from PyQt5 import QtWidgets, uic
  2. from PyQt5.QtWidgets import QApplication, QWidget
  3. import sys
  4.  
  5. Form, Window = uic.loadUiType("1.ui")
  6.  
  7.  
  8. class App(QWidget):
  9.     def __init__(self):
  10.         self.ui = uic.loadUi("1.ui")
  11.         self.start()
  12.  
  13.     def start(self):
  14.         self.ui.show()
  15.         self.set()
  16.  
  17.     def set(self):
  18.         self.btn1.clicked.connect(self.button_clicked)
  19.  
  20.     def button_clicked(self):
  21.         self.label.setText("you pressed the button")
  22.         self.update()
  23.  
  24.     def update(self):
  25.         self.label.adjustSize()
  26.  
  27.  
  28. def window():
  29.     app = QApplication([])
  30.     window = Window()
  31.     form = Form()
  32.     form.setupUi(window)
  33.     window.show()
  34.     sys.exit(app.exec_())
  35.  
  36.  
  37. window()
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement