Home > other >  Consult pyqt5 problem, a great god. Why didn't perform function initUI button_response () and f
Consult pyqt5 problem, a great god. Why didn't perform function initUI button_response () and f

Time:10-09

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # implementation form the business logic of the # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
The import sys
The import OS
The from PyQt5 import QtCore QtGui, QtWidgets
The from PyQt5. QtWidgets import *
The from PyQt5. QtCore import *
The from PyQt5. QtGui import *

The from Mainwindow import Ui_MainWindow

The class Main_1 (QMainWindow) : # QmyWidget (QMainWindow)
Def __init__ (self, parent=None) :
Super (Main_1, self) __init__ (parent) # call the superclass constructor, create forms, super (QmyWidget, self)
QMainWindow. __init__ (self)
The self. The UI=Ui_MainWindow # () to create the UI object

Self. SetupUi (self) # construct UI interface
The self. The tabWidget. TabBar (.) setVisible (False)
The self. The initUI ()
Self. Button_response ()



Def initUI (self) :
Include all of the UI Settings "" "" ""
The self. The tabWidget. TabBar (.) setVisible (False)

# def button_response (self) :
"" all the button in the" app "","
# self. Btn_1. Clicked. Connect (self. Back_home ())
# # self. Btn_3. Clicked. Connect (self. Open_rainflow_counting)
# self. Btn_4. Clicked. Connect (self. Open_statistical_distribution)
# self. Btn_5. Clicked. Connect (self. Open_life_prediction)


# def on_btnRainflow_clicked (self) :
# self. UI. Input1_1. SetText (total) # (. % 2 f, % of total),. % 2 f for automatic round

# below five function switch Settings on the surface of the home page interface
# def back_home (self) :
# self. TabWidget. SetCurrentIndex (0)

# def open_signal_processing (self) :
# self. TabWidget. SetCurrentIndex (1)

# def open_rainflow_counting (self) :
# self. TabWidget. SetCurrentIndex (2)

# def open_statistical_distribution (self) :
# self. TabWidget. SetCurrentIndex (3)

# def open_life_prediction (self) :
# self. TabWidget. SetCurrentIndex (4)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # form test program # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

If __name__=="__main__" : # for the current form test
App=QApplication (sys. Argv) # to create a GUI application
# # form=QtWidgets. QMainWindow () to create the form
# UI=Ui_MainWindow ()
# UI. SetupUi (form)
# form. The show ()
# app. Exec_ ()
The demo=Main_1 ()
The demo. The show ()
Sys. Exit (app. Exec_ ())
  • Related