python - Value in MainWindow returned from childWindow -


how send value childwindow mainwindow once childwindow closed?.

when "closebutton" in childwindow pressed, childwindow sends calculated value mainwindow.

i did test this:

def closeevent(self, evnt):         value = 34         return value 

and didn't work, got this:

typeerror: invalid result type childwindow.closeevent() 

here simple example how can that:

import sys pyqt4 import qtgui   class window(qtgui.qwidget):     def __init__(self):         qtgui.qwidget.__init__(self)          self.button = qtgui.qpushbutton("make child")         self.button.clicked.connect(self.openchildwindow)          layout = qtgui.qvboxlayout(self)         layout.addwidget(self.button)      def openchildwindow(self):         self.childwindow = childwindow(self)         self.childwindow.setgeometry(650, 350, 200, 300)         self.childwindow.show()      def printresult(self, value):           print value  class childwindow(window):     def __init__(self, parentwindow):         super(childwindow, self).__init__()         self.parentwindow = parentwindow         self.parentwindow.printresult("i'm in child init")         self.button.setdisabled(1)      def closeevent(self, event):         self.parentwindow.printresult("closing child, text returned parent")  if __name__ == '__main__':      app = qtgui.qapplication(sys.argv)     window = window()     window.setgeometry(600, 300, 200, 300)     window.show()     sys.exit(app.exec_()) 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -