[Tutor] passing data to Python callback

vicki@stanfield.net vicki@stanfield.net
Fri Feb 21 11:44:00 2003


First, I apologize for my errant post earlier and for
the wrong subject on my follow-up message. I am not an
idiot - I just play one on this list.

Now my question:

How do you pass data to a callback? Is it done in the
bind statement? I have done this in Motif, but I am new
to this Python/Tkinter thing.

Here is a code snippet:

---------------
CommandListbox = Listbox(Frame1) 
CommandListbox.insert("end","First entry")
CommandListbox.insert("end","Second entry")
CommandListbox.pack()
index = CommandListbox.index('active')
CommandListbox.bind('<Button-1>',
CommandListboxCallback)
---------------

What I would like to do is pass the index of the
selected entry to the callback, so how do I pass
additional information beyond the event?

Thank you.

--vicki