[Tkinter-discuss] No Parameters fo Callback functions?

Stewart Midwinter stewart.midwinter at gmail.com
Wed Nov 2 18:17:17 CET 2005

Samuel, you can use lambda for this purpose.    Here's how you would
use lambda in a menu to specify arguments to pass to a callback

command = lambda self=self, viewer=viewer:
self.open_pw_display(viewer, self.pwDisplays[viewer])

Note that you have to pass in a reference to the class you are in,
using 'self', or the lambda won't find your method.


Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com
Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad

More information about the Tkinter-discuss mailing list