You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IDLE: Non-English IME input triggers single-letter shortcuts instead of typing characters (Windows) #162837
Description
When using IDLE with a non-English Input Method Editor (IME) (e.g., Microsoft Pinyin, Japanese IME) on Windows, typing code characters triggers single-letter IDLE shortcuts instead of inserting the characters into the editor. This makes it impossible to write code while the IME is active.
Steps to Reproduce
Open IDLE on Windows.
Switch the input method to a non-English IME (e.g., Microsoft Pinyin).
Ensure the IME is in a state where it would normally accept character input (e.g., typing pinyin).
Type print().
Observe that the characters p, r, and t do not appear in the editor. Instead, IDLE executes keyboard shortcuts bound to those single letters (e.g., p may trigger "Python Documentation", r triggers "Search Dialog").
Expected Behavior
The characters p, r, i, n, t should be inserted into the editor (or intercepted by the IME for composition), regardless of the active input method.
Actual Behavior
Single-letter shortcuts are triggered, and characters are lost.
Additional Context
This issue has existed for at least a decade.
The root cause appears to be that Tkinter's Text widget on Windows does not correctly handle the WM_IME_COMPOSITION message or properly identify the IME composition state. As a result, raw KeyPress events are captured by IDLE's key-binding mechanism before the IME can process them.
A fix likely requires changes at the Tkinter C-extension level (Modules/_tkinter.c) or the Tk/Tcl level, rather than just Python-level changes in IDLE.
This affects not just Chinese users but also Japanese, Korean, and any user with a non-English IME on Windows. It's a common pain point for beginners who may not realize they need to switch to English input to write code.
Activity
9calebscript9 commentedon Nov 29, 2026
GongSunFangYun commentedon Nov 29, 2026
This affects not just Chinese users but also Japanese, Korean, and any user with a non-English IME on Windows. It's a common pain point for beginners who may not realize they need to switch to English input to write code.
picnixz commentedon Nov 29, 2026
GongSunFangYun commentedon Nov 29, 2026
GongSunFangYun commentedon Nov 29, 2026
picnixz commentedon Nov 29, 2026
GongSunFangYun commentedon Nov 29, 2026