# -*- coding: utf-8 -*- # basic importation for basic OS functions import sys # Library to use the Qt interface import PyQt5 from PyQt5.QtWidgets import * # GUI create by Designer and converted with pyuic5 # commande line: pyuic5 -x gphmdly.ui -o uigpgmdlg.py from uigphmdlg import Ui_MainWindow # create class for our Raspberry Pi GUI class GPHMDlg(QMainWindow, Ui_MainWindow): # access variables inside of the UImab's file ####################################### ### functions to call for the menubar def pressMenuFileActionQuit(self): sys.exit(0) ##################################### # functions to call for the tab config def pressconfigOKButtonSendCmd(self): print ("Test commande du bouton configOK") def __init__(self): # first method #super(self.__class__, self).__init__() # second method super (GPHMDlg, self).__init__() # set up the user interface from Designer self.setupUi(self) # defined in the UI file #self.connectActions() # list of action def connectActions(self): self.fileActionQuit.triggerred.connect(lambda: self.pressMenuFileActionQuit()) ### Hooks for menu bar section => NO good code !! self.fileActionQuit.triggerred.connect(lambda: self.pressMenuFileActionQuit()) ### Hooks for tab config section self.configOKButton.clicked.connect(lambda: self.pressconfigOKButtonSendCmd()) #menuH.actionQuit.clicked.connect(lambda: self.pressMenuFileActionQuit()) # self.pushButtonSendCmd.clicked.connect(lambda: self.pressedOnButtonSendCmd()) # self.btnOff.clicked.connect(lambda: self.pressedOffButton()) # I feel better having one of these #def main(): # # a new app instance # app = QApplication(sys.argv) # form = MainWindow() # form.show() # without this, the script exits immediately. # sys.exit(app.exec_()) # for test and debug this module if __name__ == "__main__": app = QApplication(sys.argv) # create the instatation form = GPHMDlg() #form.resize(350, 150) form.move(300, 300) form.setWindowTitle('GPHM - Passif Masser telecontrol') #dispèlay the personal form form.show() # main loop, without the below line the script exits immediately. sys.exit(app.exec_())