Usando um arquivo UI do Qt Designer com seu código Python
This commit is contained in:
23
aula203-qtdesigner/src/main_window.py
Normal file
23
aula203-qtdesigner/src/main_window.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
from PySide6.QtWidgets import QApplication, QMainWindow
|
||||||
|
from window import Ui_MainWindow
|
||||||
|
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.buttonSend.clicked.connect(self.changeLabelResult) # type: ignore
|
||||||
|
|
||||||
|
def changeLabelResult(self):
|
||||||
|
text = self.lineName.text()
|
||||||
|
self.labelResult.setText(text)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
mainWindow = MainWindow()
|
||||||
|
mainWindow.show()
|
||||||
|
app.exec()
|
||||||
Reference in New Issue
Block a user