Changing global variables in tkinter/pmw callback

Brian Elmegaard be at mek.dtu.dk
Wed Apr 11 05:02:18 EDT 2001


Alex Martelli wrote:
> 
> Which would become, to be literal in the transliteration:
> 
>     def configure_command(self=self, button=button,
>             buttons=self.buttons, setting=CurrentCanvasSetting):
>         self.apply(button, buttons, setting)
> 
>     button.configure(command = configure_command)

So that's the way. I see.

> Here, if I understand correctly, what you're trying to do
> is somehow set an appropriate "global" string when a
> function is executed.  If that CurrentCanvasSetting is

yes.
> 
>     def apply(self, button, modobj, varname):
>         setattr(modobj, varname, button.cget('text'))

Ahh. But still it's not really like assigning to a global...

Thanks again, Alex.

-- 
Brian
http://www.et.dtu.dk/energysystems
http://www.rk-speed.dk http://fiduso.dk http://sunsite.auc.dk/dk-tug
\TeX, tak



More information about the Python-list mailing list