[Python-checkins] cpython: Issue #989712: update the code to process tkinter messages in IDLE

andrew.svetlov python-checkins at python.org
Mon Mar 26 21:00:11 CEST 2012


http://hg.python.org/cpython/rev/837ac3abf0c5
changeset: 75955:837ac3abf0c5
user: Andrew Svetlov <andrew.svetlov at gmail.com>
date: Mon Mar 26 21:56:44 2012 +0300
summary:
 Issue #989712: update the code to process tkinter messages in IDLE
 without mainloop.
 Thanks to Roger Serwy for patch.
files:
 Lib/idlelib/run.py | 15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -6,6 +6,7 @@
 import _thread as thread
 import threading
 import queue
+import tkinter
 
 from idlelib import CallTips
 from idlelib import AutoComplete
@@ -39,18 +40,14 @@
 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
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /