Using an object inside a class

Jonno jonnojohnson at
Mon Jan 23 16:52:09 EST 2012

On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly <ian.g.kelly at> wrote:
> Exactly.  The line "app = MyApp(0)" creates a MyApp instance and then
> assigns it to "app".  As part of the MyApp creation process, it
> creates a MyFrame, which creates a Tab, which creates a Class1, which
> attempts to reference "app".  All of this happens before that
> "MyApp(0)" call has returned, so the result of that call has not
> actually been assigned to "app" yet.
> I suggest using wx.GetApp() instead.
> That totally makes sense. However I'm not sure I understand your
suggestion how to use wx.GetApp()
Isn't the wxApp still not created before Class1 is instantiated so I still
can't call wx.GetApp() in __init__ of Class1 can I?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list