'Sending a message to tkinter running GUI from an outside thread

What is the best way to send a message to a tkinter frame from an outside thread without freezing the frame?

I tried using bind and event_generate but the data field is missing in the event object (and not missing for the event_generate function):

class GUI(tk.Tk):
    ...
    def func(self, event)
        print(event.data) #AttributeError: 'Event' object has no attribute 'data'

    self.bind('<<test>>', func)

class worker():
    ...
    self.event_generate('<<test>>', data = "test_obj")

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source