diff options
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r-- | Lib/idlelib/run.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index b0a4794..dbf046b 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -7,6 +7,7 @@ import traceback import _thread as thread import threading import queue +import tkinter from idlelib import CallTips from idlelib import AutoComplete @@ -39,6 +40,17 @@ else: return s warnings.formatwarning = idle_formatwarning_subproc + +tcl = tkinter.Tcl() + + +def handle_tk_events(tcl=tcl): + """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.""" + tcl.eval("update") + + # 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: @@ -94,6 +106,7 @@ def main(del_exitfunc=False): 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) @@ -168,7 +181,9 @@ def print_exception(): print_exc(type(cause), cause, cause.__traceback__) print("\nThe above exception was the direct cause " "of the following exception:\n", file=efile) - elif context is not None and context not in seen: + elif (context is not None and + not exc.__suppress_context__ and + context not in seen): print_exc(type(context), context, context.__traceback__) print("\nDuring handling of the above exception, " "another exception occurred:\n", file=efile) @@ -312,6 +327,7 @@ class MyHandler(rpc.RPCHandler): sys.stdin = _RPCInputFile(self.console) sys.stdout = _RPCOutputFile(self.get_remote_proxy("stdout")) sys.stderr = _RPCOutputFile(self.get_remote_proxy("stderr")) + sys.displayhook = rpc.displayhook # page help() text to shell. import pydoc # import must be done here to capture i/o binding pydoc.pager = pydoc.plainpager |