tkinter: Unexpected behavior caused by Chinese input method
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Windows 上 IDLE 编辑器的 tkinter 事件绑定入手,使用中文输入法输入 r、t 和 p 后按 Enter,以复现该行为。将 event.char 与 event.keysym、keycode 和 keysym_num 进行比较,并查看关联的 PR gh-125352。当这些输入不再意外触发 F3、F5 或 F1 命令时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- desktop
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100