← 输入框|github.com|刷新
Skip to content

IDLE: Non-English IME input triggers single-letter shortcuts instead of typing characters (Windows) #162837

Backlog

Description

@GongSunFangYun

Bug report

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

  1. Open IDLE on Windows.
  2. Switch the input method to a non-English IME (e.g., Microsoft Pinyin).
  3. Ensure the IME is in a state where it would normally accept character input (e.g., typing pinyin).
  4. Type print().
  5. 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.

Videos
https://github.com/user-attachments/assets/fa40a895-798f-4efd-8618-4881377fe70e

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Activity

  1. added
    type-bug
    on Nov 29, 2026
  2. 9calebscript9 commented on Nov 29, 2026

    @9calebscript9
  3. GongSunFangYun commented on Nov 29, 2026

    @GongSunFangYun
    Author

    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.

  4. added
    stdlib
    on Nov 29, 2026
  5. picnixz commented on Nov 29, 2026

    @picnixz
  6. GongSunFangYun commented on Nov 29, 2026

    @GongSunFangYun
    Author
  7. GongSunFangYun commented on Nov 29, 2026

    @GongSunFangYun
    Author
  8. picnixz commented on Nov 29, 2026

    @picnixz
  9. GongSunFangYun commented on Nov 29, 2026

    @GongSunFangYun
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtopic-IDLEtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions