On Monday 29 September 2003 15:17, Igor Stroh wrote:

> add 'global a' to callback():
> def callback(self, widget, data=None):
>       global a
>       a = "%s" % ((3, 4)[widget.get_active()]
>
> However, using global variables is bad style, why don't you make 'a' a
> class variable?
>
> HTH,
> Igor

tks a lot Igor for your quick answer, it work fine :)
If I do:

class prova:
        a=2
        def callback(self, widget, data=None):
                a = "%s" % ((3, 4)[widget.get_active()])
        def call1(self, widget, data=None):
                print a

I have this error: NameError: global name 'a' is not defined
also if I check the button.
can you explain to me how I can make 'a' a class variable?

tks 1k
Mario aka Liquid

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to