Index: run.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v retrieving revision 1.29 diff -c -r1.29 run.py *** run.py 4 Jul 2004 01:25:56 -0000 1.29 --- run.py 12 Jul 2004 20:01:44 -0000 *************** *** 34,39 **** --- 34,59 ---- return s warnings.formatwarning = idle_formatwarning_subproc + # _tkinter.dooneevent is a function which handles any pending Tk events, and + # returns 1 if there are more to be done. Here we emulate the behaviour in + # the default interactive shell, and handle Tk events while a command isn't + # being executed. + # Handling Tk events is done only if there is an active tkapp object. It is + # created by Tkinter.Tk.__init__, which sets Tkinter._default_root to itself, + # when Tkinter._support_default_root is True (the default). Here we check + # whether Tkinter._default_root is something before we handle Tk events. + # If _tkinter is not available, use a dummy function. + + try: + import _tkinter + except ImportError: + handle_tk_events = lambda: None + else: + def handle_tk_events(): + if "Tkinter" in sys.modules and sys.modules["Tkinter"]._default_root: + while _tkinter.dooneevent(_tkinter.DONT_WAIT): + 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 and exit flags: *************** *** 84,89 **** --- 104,110 ---- try: seq, request = rpc.request_queue.get(0) except Queue.Empty: + handle_tk_events() time.sleep(0.05) continue method, args, kwargs = request