Thank you, I knew about this, but i want to do the initialization
outside of any method.
I realized it's not a pygtk problem, so i'll ask the python list

Regards
Imre

On Fri, 2009-08-07 at 09:42 +0200, [email protected] wrote:
> In this form it works ...
> 
> class MainWindow:
>     def __init__(self):
>         self.signal={'onAction':'self.onAction()'}
> 
>     def onAction(self):
>         print("ciao")
>     def getSignal(self):
>         exec self.signal['onAction']
> 
> 
> if __name__=='__main__':
>     obj=MainWindow()
>     obj.getSignal()
> 
> Regards
> Matteo
> 
> 
> 
> 
> 
> > Hi!
> > 
> > I want to create a dict like this:
> > 
> > class MainWindow:
> > 
> >     signals = {
> >             'on_action1_activate': self.on_action1,
> >     }
> > 
> >     def __init__(self):
> >             ...
> > 
> >     def on_action1(self):
> >             ...
> > 
> > It results:
> > NameError: name 'self' is not defined.
> > 
> > I've tried it without the self, MainWindow.on_action1, etc. but no
> > luck...
> > 
> > Thanks in advance:
> > Imre Horvath
> > 
> > _______________________________________________
> > pygtk mailing list   [email protected]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> > 
> 

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to