Debug mainloop events

Vasilis Vlachoudis <[email protected]> Thu, 13 Feb 2020 15:11:12 +0000
Newsgroups gmane.comp.python.tkinter
Message-ID <[email protected]>
Hi all,

is there a way to debug the mainloop events execution.
I want to check which functions are causing some delay.
The code is too big to run with a profiler and/or add some decorators in every function.

What I would like is to have full control of the main loop, replace it with something like

while True:
     event = get_event
     if event:
            tstart = time.time()
            execute event
            print("time executing event", event, time.time() - tstart)

Vasilis