The simplest solution would seem to be to create a little class that
serves as a container for the per-item data, create an instance for
each item, and use a method of the instance as a callback. For
example:
class PerItem:
def __init__(self, per_item_data):
self.per_item_data = per_item_data
def callback(self, *args):
print self.per_item_data
for line in open(filename).readlines():
per_item = PerItem(line)
b = (...create the menu item...)
b['command'] = per_item.callback
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>