tkinter radiobutton

Peter Otten __peter__ at web.de
Tue Jun 28 12:17:53 EDT 2005


William Gill wrote:

> The radiobutton widget knows if it is selected or unselected, or it
> wouldn't be able to display correctly, but based on what I'm seeing,
> that information is inaccessable to the app.  Instead the app must
> evaluate an associated control variable.  That doesn't make sence to me,
> but even trying to look at the code for the radiobutton class didn't help.

I guessed you wanted to solve a practical problem, but the thoughts
expressed above suggest, err, philosophical qualms. So, for the sake of the
argument and since we both don't know the implementation details, be it in
C or TCL, let's assume that the individual radiobuttons do *not* /know/
whether they are selected or not but instead compare their associated
'variable' with their 'value' every time they are /asked/ to draw
themselves. That would avoid duplicate state and require only log N instead
of N bits. Wouldn't that be an elegant implementation, at least in theory?

So why bother about the layers below when you have all the information to
write code that works?

Peter





More information about the Python-list mailing list