Again because the function is out of the class it has no attribute
self.
self points to the class it belongs to. So since you are not in the
class you have to manually point to the function which in this case
is:
app.MainWindow
Again because the function is out of the class it has no attribute
self.
self points to the class it belongs to. So since you are not in the
class you have to manually point to the function which in this case
is:
app.MainWindow
On Apr 3, 9:47 pm, craf <abarz...@gmail.com> wrote:
>-----Mensaje original-----
>De: VC <napoleon...@gmail.com>
>Reply-to: wxpython-users@googlegroups.com
>Para: wxPython-users <wxpython-users@googlegroups.com>
>Asunto: [wxPython-users] Re: Call function outside the class
>Fecha: Tue, 3 Apr 2012 19:38:17 -0700 (PDT)
>One more thing:
>if you decide you want the function out of the class it should be:
>def OnClick(evt):
> app.MainWindow.button.SetLabel('Clicked')
>Again because the function is out of the class it has no attribute
>self.
>self points to the class it belongs to. So since you are not in the
>class you have to manually point to the function which in this case
>is:
>app.MainWindow
>VC
-----Mensaje original-----
De: VC <napoleonics@gmail.com>
Reply-to: wxpython-users@googlegroups.com
Para: wxPython-users <wxpython-users@googlegroups.com>
Asunto: [wxPython-users] Re: Call function outside the class
Fecha: Tue, 3 Apr 2012 21:17:24 -0700 (PDT)
On Apr 3, 9:47 pm, craf <abarz...@gmail.com> wrote:
>-----Mensaje original-----
>De: VC <napoleon...@gmail.com>
>Reply-to: wxpython-users@googlegroups.com
>Para: wxPython-users <wxpython-users@googlegroups.com>
>Asunto: [wxPython-users] Re: Call function outside the class
>Fecha: Tue, 3 Apr 2012 19:38:17 -0700 (PDT)
>One more thing:
>if you decide you want the function out of the class it should be:
>def OnClick(evt):
> app.MainWindow.button.SetLabel('Clicked')
>Again because the function is out of the class it has no attribute
>self.
>self points to the class it belongs to. So since you are not in the
>class you have to manually point to the function which in this case
>is:
>app.MainWindow
>VC
Hi VC
Thanks for the Tips!
Best Regards
Cris
Hi cris,
I actually made a mistake, it is window.button.SetLabel('clicked')
I did not pay attention to how you set up your app.
here is the code, i tested it, it works.