example in later in this we'll also meet the multiprocessing modulewhose process and queue support offers new options for implementing this gui model using processes instead of threadsas suchthey work around the limitations of the thread gilbut may incur extra performance overheads that can vary per platformand may not be directly usable at all in threading contexts (the direct shared and mutable object state of threads is not supportedthough messaging isfor nowlet' cover few final thread fine points thread timers versus gui timers interestinglythe threading module exports general timer functionwhichlike the tkinter widget after methodcan be used to run another function after timer has expiredtimer( msomefuncstart(after seconds run somefunc timer objects have start(method to set the timer as well as cancel(method to cancel the scheduled eventand they implement the wait state in spawned thread for examplethe following prints message after secondsimport sys from threading import timer timer( lambdaprint('spam!') start(spamspawned thread this may be useful in variety of contextsbut it doesn' quite apply to guisbecause the time-delayed function call is run in spawned threadnot in the main gui threadit should not generally perform gui updates because the tkinter after method is run from the main thread' event processing loop insteadit runs in the main gui thread and can freely update the gui as previewfor instancethe following displays pop-up message window in seconds in the main thread of tkinter gui (you might also have to run win main loop(in some interfaces)from tkinter import tk from tkinter messagebox import showinfo win tk(win after( lambdashowinfo('popup''spam!')the last call here schedules the function to be run once in the main gui threadbut it does not pause the caller during the waitand so does not block the gui it' equivalent to this simpler formwin after( showinfo'popup''spam'stay tuned for much more on tkinter in the next part of this bookand watch for the full story on its after timer events in and the roles of threads in guis in parallel system tools