The from PyQt5 import QtCore QtGui, QtWidgets
The from PyQt5. QtWidgets import *
The class Ui_Dialog (object) :
Def setupUi (self, Dialog) :
Dialog. SetObjectName (" Dialog ")
Dialog. The resize (524, 371)
The self. The pushButton=QtWidgets. QPushButton (Dialog)
The self. The pushButton. SetGeometry (QtCore QRect (190, 100, 75, 23))
The self. The pushButton. SetObjectName (" pushButton ")
Self. RetranslateUi (Dialog)
QtCore. QMetaObject. ConnectSlotsByName (Dialog)
The self. The pushButton. Clicked. Connect (self. MSG)
Def MSG (self) :
Print (' hello ')
Text, ok=QInputDialog. GetText (self, 'input text box', 'please enter your text content)
Def retranslateUi (self, Dialog) :
_translate=QtCore. QCoreApplication. Translate
Dialog. SetWindowTitle (_translate (" Dialog ", "Dialog"))
The self. The pushButton. SetText (_translate (" Dialog ", "pushButton"))
If __name__=="__main__" :
The import sys
App=QApplication (sys. Argv)
Dialog=QDialog ()
UI=Ui_Dialog ()
UI. SetupUi (dialog)
Dialog. The show ()
Sys. Exit (app. Exec_ ())