Rotwang <sg...@hotmail.co.uk> writes:

> Here's something that does work:
>
>     menu = Tkinter.Menu(master, tearoff = 0)
>     for k in x:
>         def f(j = k):
>             [do something that depends on j]
>         menu.add_command(label = str(k), command = f)
>
> Still, I'd like to know if there's a more elegant method for creating
> a set of functions indexed by an arbitrary list.

That already seems quite elegant to me. What part is inelegant to your
eye?

-- 
 \         “I'm not a bad guy! I work hard, and I love my kids. So why |
  `\      should I spend half my Sunday hearing about how I'm going to |
_o__)                                            Hell?” —Homer Simpson |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to