cpython: 837ac3abf0c5 (original) (raw)
Mercurial > cpython
changeset 75955:837ac3abf0c5
Issue #989712: update the code to process tkinter messages in IDLE without mainloop. Thanks to Roger Serwy for patch. [#989712]
Andrew Svetlov andrew.svetlov@gmail.com | |
---|---|
date | Mon, 26 Mar 2012 21:56:44 +0300 |
parents | 64336c441320 |
children | 06d613acf16c |
files | Lib/idlelib/run.py |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-)[+] [-] Lib/idlelib/run.py 15 |
line wrap: on
line diff
--- 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[](#l1.25)
# tk has been loaded.[](#l1.26)
root = tkinter._default_root[](#l1.27)
while root.tk.dooneevent(tkinter._tkinter.DONT_WAIT):[](#l1.28)
# Process pending events.[](#l1.29)
pass[](#l1.30)