Hi,
Thanks to this topic, I am able to create dynamic buttons with click event.
However, in the click event, is there away to get the name of the button that is clicked, so that relevant action will be taken?
Any help is greatly appreciated.
Hi,
Thanks to this topic, I am able to create dynamic buttons with click event.
However, in the click event, is there away to get the name of the button that is clicked, so that relevant action will be taken?
Any help is greatly appreciated.
Iād suggest dynamically adding a name to the tag attribute.
x = Button()
x.tag.name = 'button1'
x.set_event_handler('click', self.click)
def click(self, **event_args):
print(event_args['sender'].tag.name)
Sometimes, if I know that my function is only raised by a click event and never called directly I will adjust the call signature.
def click(self, sender, **event_args):
print(sender.tag.name)