tkinter: Unexpected behavior caused by Chinese input method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
Entering "r", "t" or "p" in the Chinese input method and press Enter in the editor will cause IDLE to behave unexpectedly.
"r": Equivalent to pressing"F3"(will excute command "Find Selection")"t": Equivalent to pressing"F5"(will excute command "Run Module")"p": Equivalent to pressing"F1"(will open Python docs link)
There may be other similar situations, and I will list three of them here. The input method I used for my test is native to the Windows operating system.
I'm not sure if this problem is caused by the input method or the tkinter event binding, maybe it's not an idle issue, but a tkinter issue. If this issue is not resolved, it will greatly affect the experience of using input methods in IDLE.
The following is a gif demonstration that reproduces the issue:
The event when this behavior is triggered and some of its properties are as follows:
| letter | event.char |
event.keysym |
event.keycode |
event.keysym_num |
|---|---|---|---|---|
| r | "r" |
F3 | 114 | 65472 |
| t | "t" |
F5 | 116 | 65474 |
| p | "p" |
F1 | 112 | 65470 |
It is clear that this is not the expected behavior. event.keysym does not match event.char.
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
- gh-125352
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the IDLE editor's tkinter event bindings on Windows and reproduce the behavior using the Chinese input method with r, t, and p followed by Enter. Compare event.char with event.keysym, keycode, and keysym_num, and review linked PR gh-125352. Done means these inputs no longer trigger the F3, F5, or F1 commands unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100