Python Forum
[PyQt] call a function with parametrs from another class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] call a function with parametrs from another class
#4
hello;
I apologize for this delay, but I changed orientation: instead of creating another class, I proceeded to create a function with arguments to replace the other functions each associated with its own widget,I proceeded like this (this is a minimal code) :
class MainApp(QMainWindow,Ui_MainWindow) :
    def __init__(self,parent=None) :
        super(MainApp,self).__init__(parent)
        QMainWindow.__init__(self)
        self.setupUi(self)
        self.win_UI()
    ################################
        parametre=QTableWidget()
    #####################################
    def win_UI(self):
        #root = QFileInfo(__file__).absolutePath() #for  absolute path of the icons
        self.setWindowTitle("ddm")
        self.setGeometry(10,40,1140,653)
        self.radioButton_correction.toggled.connect(self.initialize_all_tableWidget)
    #initialize tableWidget  :  
    def initialize_correction_tableWidget(self,parametre):  
        parametre.clear()
        parametre.setHorizontalHeaderItem(0, QTableWidgetItem("date"))
        parametre.setHorizontalHeaderItem(1, QTableWidgetItem("hour"))
        parametre.setHorizontalHeaderItem(2, QTableWidgetItem("Monitor1"))
        parametre.setHorizontalHeaderItem(3, QTableWidgetItem("Monitor2"))
    #initialize all tableWidget  :  
    def initialize_all_tableWidget(self):
        for correction in  (self.tableWidget_correction_loc35R,self.tableWidget_correction_loc35L,self.tableWidget_correction_gp35R,self.tableWidget_correction_gp35L,self.tableWidget_rechercher_operation_cev_loc35R,self.tableWidget_rechercher_operation_cev_gp35R,self.tableWidget_rechercher_operation_cev_loc35L,self.tableWidget_rechercher_operation_cev_gp35L) :
            self.initialize_correction_tableWidget(correction)

def main():
    app=QApplication(sys.argv)
    win=MainApp()
    win.show()
    app.exec_()# infinite loop
if __name__=='__main__' :
    main()
Reply


Messages In This Thread
RE: call a function with parametrs from another class - by atlass218 - Feb-29-2020, 11:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GUI Problem / call another function / fill QListwidget flash77 5 892 Jul-30-2023, 04:29 PM
Last Post: flash77
  simple tkinter question function call not opening image gr3yali3n 5 3,460 Aug-02-2022, 09:13 PM
Last Post: woooee
  [PyQt] Call a function in FormA from FormB panoss 3 1,906 Jan-30-2022, 07:45 PM
Last Post: panoss
  Call local variable of previous function from another function with Python3 & tkinter Hannibal 5 4,460 Oct-12-2020, 09:16 PM
Last Post: deanhystad
  Class function does not create command button Heyjoe 2 2,287 Aug-22-2020, 08:06 PM
Last Post: Heyjoe
  [Tkinter] Use function from other class (Tkinter) zarize 8 4,854 Aug-17-2020, 09:47 AM
Last Post: zarize
  [Tkinter] Call a class method from another (Tk GUI) class? Marbelous 3 6,241 Jan-15-2020, 06:55 PM
Last Post: Marbelous
  [Tkinter] Call a function when switching layouts 4096 0 3,545 Sep-22-2019, 07:39 PM
Last Post: 4096
  [PyQt] call a function in another class darktitan 6 14,158 Jun-22-2019, 03:33 AM
Last Post: darktitan
  [Tkinter] Bringing function out of class into main loop zukochew 1 2,687 Jul-30-2018, 06:43 PM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020