WXPYTHON push button call a frame
kyosohma at gmail.com
kyosohma at gmail.com
Thu Jul 5 11:09:26 EDT 2007
On Jul 5, 9:04 am, Marcpp <mar... at gmail.com> wrote:
> On 5 jul, 14:51, Steve Holden <s... at holdenweb.com> wrote:
>
>
>
> > Marcpp wrote:
> > > 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?
>
> > Well, one *really* good idea would be to copy the error message and
> > paste it into your message. The readers of this list have amazing
> > psychic powers, but you can always help improve the answer quality by
> > providing relevant information.
>
> > > .....
> > > def DialogRRHH(self,event):
> > > prog = wx.PySimpleApp(0)
> > > wx.InitAllImageHandlers()
> > > DialogRRHH = MTRRHH(None, -1, "")
> > > prog.SetTopWindow(DialogRRHH)
> > > DialogRRHH.Show()
> > > prog.MainLoop()
>
> > > class MTRRHH(wx.Frame):
> > > .......
> > > if __name__ == "__main__":
> > > app = wx.PySimpleApp(0)
> > > wx.InitAllImageHandlers()
> > > tasques = tasques(None, -1, "")
> > > app.SetTopWindow(tasques)
> > > tasques.Show()
> > > app.MainLoop()
>
> > Unfortunately your code extracts don't tell us what's going wrong, only
> > how the program is constructed. While that *is* useful information, by
> > itself it only paints half the picture.
>
> > regards
> > Steve
> > --
> > Steve Holden +1 571 484 6266 +1 800 494 3119
> > Holden Web LLC/Ltd http://www.holdenweb.com
> > Skype: holdenweb http://del.icio.us/steve.holden
> > --------------- Asciimercial ------------------
> > Get on the web: Blog, lens and tag the Internet
> > Many services currently offer free registration
> > ----------- Thank You for Reading -------------
>
> Hi, the problem is No Error message, but the program continues running
> after I closed it (by the X).
When I open a custom frame from one of my applications, I do something
like this:
<main app code>
def BtnEventHandler(self, event):
frame = myFrame()
frame.Show()
</main app code>
<myframe code>
class myFrame(wx.Frame):
def __init__(self, filename=None):
wx.Frame.__init__(self, None, -1, 'Whatever', size=(570,295))
# you can set the OnTop style here
# lots of other code...
def OnClose(self, event):
# Close the frame
self.Close()
</myframe code>
If you have additional problems, try mailing the wxPython group, which
you can find here: www.wxpython.org
Mike
More information about the Python-list
mailing list