Tim Daneliuk wrote:

I am trying to initialize a menu in the following manner:

for entry in [("Up", KeyUpDir), ("Back", KeyBackDir), ("Home", KeyHomeDir), ("Startdir", KeyStartDir), ("Root", KeyRootDir)]:

func = entry[1]
UI.ShortBtn.menu.add_command(label=entry[0], command=lambda: func(None))


However, at runtime, each of the menu options binds to the *last* function
named in the list (KeyStartDir).

Explicitly loading each entry on its own line works fine:

UI........command=lambda:KeyWHATEVERDir(None)

Any ideas why the first form does not fly?


TIA,
----------------------------------------------------------------------------


Tim Daneliuk     [EMAIL PROTECTED]
PGP Key:         http://www.tundraware.com/PGP/

Thanks All - great responses!

--
----------------------------------------------------------------------------
Tim Daneliuk     [EMAIL PROTECTED]
PGP Key:         http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to