wxpython - Python Cannot close using self.Close(True) -


when click on run button directly without clicking on cv button or ir button i've created, close window. if click on cv button or ir button clicked on exit button, not work. try remove app.mainloop() inside both cv , ir button still not working.

p/s cv_button , ir_button call .py file gui. dont know how call main in python @ least works , dont know if right or wrong.

def cv_button(self, event):  # wxglade: main.<event_handler>      if __name__ == "__main__":         app = wx.pysimpleapp(0)         wx.initallimagehandlers()         mainframe = cv(none, -1, "")         app.settopwindow(mainframe)         mainframe.show()         app.mainloop()      event.skip()  def ir_button(self, event):  # wxglade: main.<event_handler>      if __name__ == "__main__":         app = wx.pysimpleapp(0)         wx.initallimagehandlers()         mainframe = ir(none, -1, "")         app.settopwindow(mainframe)         mainframe.show()         app.mainloop()      event.skip()  def exit_button(self, event):  # wxglade: main.<event_handler>     self.close(true)     event.skip()  if __name__ == "__main__": app = wx.pysimpleapp(0) wx.initallimagehandlers() main = main(none, -1, "") app.settopwindow(main) main.show() app.mainloop() 

you can not have more 1 wx.app per application. thus, cannot have 2 mainloops either. there needs 1 instance of wx.app (or wx.pysimpleapp, although that's deprecated). remove others , work.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -