python - Send data processed from one window to mainwindow in pyqt -


i using pyqt build gui, using .ui file qt designer, , convert pyuic4.

i have 2 windows,
1st - mainwindow (which has label , buttons)
2nd - window numeric keypad input window.

i have .py of ui file seperate , load in main program

class mainwindow(qtgui.qwidget):     def __init__(self, parent = none):         super(mainwindow, self).__init__(parent)         self.ui = ui_main()         self.ui.setupui(self) # same keypad window also.. # inside keypad window class have added functions click & display events. 

when click button in mainwindow, num keypad window should open. (i have done successfully)

the main code follows,

def main():     app = qtgui.qapplication(sys.argv)     home = mainwindow()   #mainwindow object     keypad = keypad()     #keypad object     home.ui.set_btn.clicked.connect(keypad.show)  #keypad window show if press set_btn     homewindow.show()     sys.exit(app.exec_()) 

i enter values using keypad , shown in space provided in same window.

now have return entered value main window update value.

this seems simple question, couldnt find plz me.

*is there existing method keypad operations, in qtdesigner or pyqt??
idea sufficient..

thanks !!!

what want, define new method handle return value.

in mainwaindow define handler:

class mainwindow(qtgui.qwidget):    def __init__(self, parent = none):       super(mainwindow, self).__init__(parent)       self.ui = ui_main()       self.ui.setupui(self)    def keypadhandler(self, value):        # handle value here 

and then, connect signal mainwindow show keypad window, make signal in keypad class , connect new handler:

def main():    app = qtgui.qapplication(sys.argv)    home = mainwindow()   #mainwindow object    keypad = keypad()     #keypad object    keypad.ui.updated_value.connect(home.keypadhandler) # updated_value show preferably emitted everytime value changes    home.ui.set_btn.clicked.connect(keypad.show)  #keypad window show if press set_btn    homewindow.show()    sys.exit(app.exec_()) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -