[Tutor] passing data to Python callback

alan.gauld@bt.com alan.gauld@bt.com
Fri Feb 21 14:14:14 2003


> 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.

This is not IMHO documented well in the Tkinter books etc.
If you use bind there will be an event parameter in the callback. 
Some of the data you need might be in the event object, but you 
need to dig hard to find the definitions of the ovbject. I 
usually find it easier to just get python to print the object 
to the console!!!

If anyone knows the scientifoifc way of doing this - like a 
reference page someplace that would be appreciated.

> CommandListbox.bind('<Button-1>',
> CommandListboxCallback)
> ---------------
> 
> What I would like to do is pass the index of the

As to your specific qurery I can't help other than to suggest 
you put some test print statements in the code of the callback 
function!

Alan G