WXPYTHON push button call a frame
rschroev_nospam_ml at fastmail.fm
Thu Jul 5 20:04:32 CEST 2007
> Hi I need to call a widget from a button in WXPYTHON. I've tried to
> this from a function like this, but when push the button, the program
> opens a window and do error.
> Any idea?
> def DialogRRHH(self,event):
> prog = wx.PySimpleApp(0)
> DialogRRHH = MTRRHH(None, -1, "")
> class MTRRHH(wx.Frame):
> if __name__ == "__main__":
> app = wx.PySimpleApp(0)
> tasques = tasques(None, -1, "")
In DialogRRHH() you create a new application object with a new event
loop, while you already have one running. wxPython should have only one
application object though; otherwise there conflicts between the
different event loops. Also you don't need to call
It seems to me that in DialogRRHH() you want to create a dialog and wait
until the user closes it. In that case, it should look more or less like
this (beware, I'm not a wxPython expert myself):
def DialogRRHH(self, event):
DialogRRHH = MTRRHH(None, -1, "")
Also, in that case MTRRHH should be a wxDialog, not a wxFrame.
In case you want to show MTRRHH without waiting for the user to close
it, use DialogRRHH.Show() instead of .ShowModal(). I think MTRRHH can be
either a wxDialog or a wxForm in that case.
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton
More information about the Python-list