Index: Lib/idlelib/run.py =================================================================== --- Lib/idlelib/run.py (revision 70642) +++ Lib/idlelib/run.py (working copy) @@ -37,6 +37,21 @@ return s warnings.formatwarning = idle_formatwarning_subproc + +def handle_tk_events(): + """Process any tk events that are ready to be dispatched if Tkinter + has been imported, a tcl interpreter has been created and tk has been + loaded.""" + Tkinter = sys.modules.get('Tkinter') + if Tkinter and Tkinter._default_root: + # Tkinter has been imported, an Tcl interpreter was created and + # tk has been loaded. + root = Tkinter._default_root + while root.tk.dooneevent(Tkinter._tkinter.DONT_WAIT): + # Process pending events. + pass + + # Thread shared globals: Establish a queue between a subthread (which handles # the socket) and the main thread (which runs user code), plus global # completion, exit and interruptable (the main thread) flags: @@ -88,6 +103,7 @@ try: seq, request = rpc.request_queue.get(block=True, timeout=0.05) except Queue.Empty: + handle_tk_events() continue method, args, kwargs = request ret = method(*args, **kwargs)