Two Tkinter questions (long)

Tim Hochberg tim.hochberg at ieee.org
Wed Jul 5 19:06:17 EDT 2000


"Grant Edwards" <ge at nowhere.none> wrote in message
news:QXO85.3118$iN5.767799 at ptah.visi.com...
> In article <sn66qkgrfv.fsf at motorola.com>, Aaron Ginn wrote:
[SNIP]
> Functions bound to events need to take an event as a parameter
> (if you don't want the event, you can use lambda to discard it):
>
> self.filter_entry.bin('<Return>', labda event: self.do_filter())

You still needs to bind self to a default variable in order for it to be
accesible inside the lambda, e.g,

self.filter_entry.bin('<Return>', lambda event, self=self :
self.do_filter())

(I suspect this is just a typo on Grant's part, but I figure I'd clarify it
for Aaron...)

-tim





More information about the Python-list mailing list