[Tutor] First step

Gregor Lingl glingl@aon.at
Thu, 15 Aug 2002 13:25:18 +0200


Pol Branckotte schrieb:

> I just try to define a window and later decide to make it visible:
> Here are the two programs, I can understand the error message 
> generated by the first
> but not the one generated by the second
> What am I missing?
> How to make it happen?
>   

I'd like to direct you to the thread

Another Class question, and the conversation between SA,
Magnus Lycka and others there,
 which has pretty much to do with your problem
 (as I don't know wxPython, I can't give you an exact
advice for solving it ... sorry)
gl


> from wxPython.wx import *
>  
> class MyApp(wxApp):
>     def OnInit(self):
>         frame = wxFrame(NULL, -1, "hello from wxPy")
>         #frame.Show(true)
>         self.SetTopWindow(frame)
>         return true
>  
> app = MyApp(0)
> app.frame.Show(true)
> app.MainLoop()
>  
> attribute error: MyApp instance has no attribute 'frame'
> __________________________________________________
>  
> from wxPython.wx import *
>  
> class MyApp(wxApp):
>     def OnInit(self):
>         frame = wxFrame(NULL, -1, "hello from wxPy")
>         #frame.Show(true)
>         self.SetTopWindow(frame)
>         return true
>  
> app = MyApp(0)
> frame.Show(true)
> app.MainLoop()
>  
> name error name "frame" is not defined
> __________________________________________________________
> Thanks
>  
> Pol