Is there any way to pass a custom parameter (string for instance) through the event_generate() method?
The problem is that i have two threads. one of them should pass a variable which is required by event handler in the other one. I've tried to declare eventHandler with additional parameter e.g. def refreshCanvas(self, event, param) but then I am unable to pass param through event_generate().
I've also tried to pass it as an existing parameter 'state', which supposed to be a string, but it does not work either.
Class that generates an event:
class GameThread(Thread):
def __init__(self, gameInstance, gui):
Thread.__init__(self)
self.__gameInstance = gameInstance
gui.event_generate("<<refresh>>", when="tail", state=str(self.__gameInstance.getState()))
The class which suppose to catch this event:
class App(ttk.Frame):
def __init__(self, parent=None):
ttk.Frame.__init__(self, parent)
parent.bind("<<refresh>>", self.refreshCanvas)
def refreshCanvas(self, event):
#something
pass