Home > other >  Novice: the main window to open the child window to fail
Novice: the main window to open the child window to fail

Time:09-26



The from PyQt5 import QtCore QtGui, QtWidgets
The from frmGkOrder import Ui_frmGkOrder

The class Ui_MainWindow (object) :
Def setupUi (self, the MainWindow) :
MainWindow. SetObjectName (" MainWindow ")
MainWindow. Resize (800, 600)
Self. Centralwidget=QtWidgets. QWidget (MainWindow)
,,,,,,,
The self. The menubar. AddAction (self) menu_4) menuAction ())
The self. The menubar. AddAction (self) menu_5) menuAction ())

Self. RetranslateUi (MainWindow)
Self. ActionGkOrder. Triggered. Connect (self. On_order)
Self. ActionExit. Triggered. Connect (self. On_exitApp)
QtCore. QMetaObject. ConnectSlotsByName (MainWindow)

Def retranslateUi (self, the MainWindow) :
_translate=QtCore. QCoreApplication. Translate
,,,,,,,


Def on_order (self) : # # # # # # # # # # # # #
Print (" initial order...
")# super (QtWidgets, self) __init__ ()
#'ve=Ui_MainWindow. GridLayout
've=Ui_frmGkOrder
#'ve setupUi ()
've setupUi ('ve) # # # # # # # # # # #


Def on_exitApp (self) :
App. The exit ()

If __name__=="__main__" :
The import sys

App=QtWidgets. QApplication (sys. Argv)
Mw=QtWidgets. QMainWindow ()
UI=Ui_MainWindow ()
UI. SetupUi (mw)
Print (" App Start...
")Mw. The show ()

sys.exit(app.exec_())
  • Related