diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-03-26 18:56:44 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-03-26 18:56:44 (GMT) |
commit | 753445a425fba3e73d9eb15f10829a194da8b7fe (patch) | |
tree | c471a78c04d2c886ec185f65095be4a15f615fdd /Lib | |
parent | 0df542985a249ae5f72ebabb3ffe76dea3f12179 (diff) | |
download | cpython-753445a425fba3e73d9eb15f10829a194da8b7fe.zip cpython-753445a425fba3e73d9eb15f10829a194da8b7fe.tar.gz cpython-753445a425fba3e73d9eb15f10829a194da8b7fe.tar.bz2 |
Issue #989712: update the code to process tkinter messages in IDLE
without mainloop.
Thanks to Roger Serwy for patch.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/idlelib/run.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 5e12f7e..7124c72 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -6,6 +6,7 @@ import traceback import _thread as thread import threading import queue +import tkinter from idlelib import CallTips from idlelib import AutoComplete @@ -39,18 +40,14 @@ else: warnings.formatwarning = idle_formatwarning_subproc -def handle_tk_events(): +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.""" - 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 + tcl.eval("update") # Thread shared globals: Establish a queue between a subthread (which handles |