[Pythonmac-SIG] wx Window Flashes and Closes Immediately

Cody Precord codyprecord at gmail.com
Mon Feb 2 05:50:51 CET 2009


Hello,

On Feb 1, 2009, at 10:42 PM, 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()
>

Should be mainFrame.Show() <- UPPER case S.

To see the traceback of errors you should create the app object with  
wx.App(False) to disable redirection of output, so tracebacks will be  
printed to the console.


Cody



More information about the Pythonmac-SIG mailing list