when I use the following code
augment.set_event_handler(link_1, ‘hover’, function1)
It worked well. But when I need to pass an additional parameter to the function, and write
augment.set_event_handler(link_1, ‘hover’, function1(parameter1))
I got an error message: “KeyError, sender”
What did I do wrong? Would really appreciate. Thanks.
Here the object function1, that is the definition of function1, is passed to the event handler:
Here function1 is called, then the returned value is passed to the event handler:
Here function1 is called with an argument, then the returned value is passed to the event handler:
Very likely all you need is to use the first form, the one with the object function. This will tell the event handler what function to call when it’s time to call it. Then, when the event is triggered, the handler will know both the function to call and the parameter values, and will call that function with the correct parameter values.