Tkinter Menu command targets function with arguments?
For this kind of stuff, especially event handlers and commands, an elegant solution is using the functools
module's partial()
method.
from functools import partial...command=partial(foo, "spam")
Partial is said to be faster than using lambda: Differences between functools.partial and a similar lambda?