[Pythonmac-SIG] wx Window Flashes and Closes Immediately

Robin Dunn robin at alldunn.com
Mon Feb 2 06:47:50 CET 2009


Bryan Smith wrote:
> Hi Everyone,
> 
> I am trying out a simple wx program from a book and anytime I try and 
> run the code, the wxFrame flashes open and closes immediately. This is 
> frustrating as the code is essentially the same as in the book. Here is 
> the code for your viewing pleasure:
> 
> import wx
> 
> class wxTest():
>    
>     def __init__(self):
>         mainApp = wx.App()
>        
>         mainFrame = wx.Frame(None)
>         mainButton = wx.Button(mainFrame)
>         mainFrame.show()
>        
>         mainApp.MainLoop()
>        
> if __name__ == "__main__":
>     w = wxTest()
> 
> What am I missing here? 

Show is spelled with a capital S.  If you pass redirect=False to the 
wx.App constructor then you'll be better able to see any problems that 
happen in the initialization code.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the Pythonmac-SIG mailing list