Changing global variables in tkinter/pmw callback

Brian Elmegaard be at mek.dtu.dk
Fri Apr 6 08:43:44 EDT 2001


Alex Martelli wrote:
> 
> 
> Glad if I have been of some help...

A lot

> 
> Now this can hardly be said to be 'lucid'... a bit better:

Indeed.
But (how) can the same be done with tkinter callbacks? 
Take the apply example of mine. How would that look with def's?

button.configure(command = lambda self=self,
                 button=button, buttons=self.buttons,
                 setting=CurrentCanvasSetting:
                 self.apply(button,buttons,setting))


In apply I (now) do:
         def apply(self,button,buttons,setting):
             setting[0]= button.cget('text')



> It's not really an issue of OO-ness, but, rather, of 'reference
> semantics for variables' versus 'container semantics for variables'.

This long explanation really clarified things for me. The thing is that
I have grown up with boxing languages, so post-it's, I now have to
learn. 

> 
> People who come from a 'boxes' background (Fortran,
> Pascal, C++, Basic) often do have problems in their
> understanding of languages with a 'post-it tags'
> paradigm (Java, Eiffel, Python) -- but the latter is
> really refreshing in its utter simplicity, total
> regularity, and self-sufficient completeness; and

Wow. I have to learn.


-- 
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