How to receive thread callbacks in Python
Complement Tkinter with a messaging-layer with an event-routing added
While a Tkinter/.mainloop()
is a self-contained Model-Visual-Controller system, you may extend it's functionality in a thread-safe, non-blocking mode with an added complementary ( inter-process / any-to-any ) Messaging Layer of your own and equip it's localhost/self actors with a Tkinter-based event-routing mechanism to integrate with the .mainloop()
################################################ SETUP EVENT-ROUTING Injectorself.aSigFromZMQ = "<<aVirtualEventSignalledFromZMQ_LAYER>>"self.bind( self.aSigFromZMQ, anEventHANDLER )# |# .bind <<virtual_EventNAME>> altogether with <anEventHANDLER>-call################################################ Context-fully TRIGGER Injectorself.event_generate( self.aSigFromZMQ, aSigContextDICT )# |# .event_generate( <eventNameId>, **args ) # triggers <eventNameId># # + passes **args, that allows# # to set <keyword>=<value> pairs for Event-fields,# # that are passed to anEventHANDLER via <Event>-object ...
For illustration and for click-through link to the genuine book from one of the fathers of the state-of-art, incredibly fast, smart & scaleable inter-process messaging system for many-to-many messaging ( incl. inter-thread signalling once based on this ) kindly ref. >>> https://stackoverflow.com/a/26559710/3666197