I’m trying to set up an event handler on repeating panel template. But I got this error : “TypeError: delete_project() got an unexpected keyword argument ‘event_name’”. While raise_event effectively has event_name as an argument.
That’s the method which is called with click event :
def delete_goal(self, **event_args):
if confirm("Are you sure you want to give up the goal {}?".format(self.item['BigGoalHeadline'])):
self.parent.raise_event("x-delete-goal", goal=self.item)
This method is supposed to trigger its parent object which will call ‘delete_goal’(parent code). And delete_goal requires an argument goal which is the goal to delete.
So my event’s name is ‘x-delete-goal’, which is the first argument of raise_event and ‘goal’ represents the argument required by ‘delete_goal’ in parent code.
All event handlers get event_args passed to them. These include the event_name and the sender, as well as any custom event args added using raise_event (in your case goal).
An alternative way to write the same event handler might be