__peter__ at web.de
Wed Jun 15 20:13:59 CEST 2005
Fredrik Lundh wrote:
> note that you're assigning all buttons to the same instance variable, so
> even if the above did work, it would always return a plus.
> since the command callback doesn't know what widget it was called
> from, you need to create a separate callback for each widget. here's
> one way to do that:
> for x in range(4):
> for y in range(4):
> text = i[t] # label text
> def callback():
Change the above function to
Otherwise you have distinct callbacks, but they are still all seeing the
same 'text' variable, probably bound to "+" by the time you press a button.
More information about the Python-list