tkinter: Unexpected behavior caused by Chinese input method
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit den tkinter-Ereignisbindungen des IDLE-Editors unter Windows und reproduziere das Verhalten mit der chinesischen Eingabemethode unter Verwendung von r, t und p, gefolgt von Enter. Vergleiche event.char mit event.keysym, keycode und keysym_num und prüfe den verknüpften PR gh-125352. Als erledigt gilt die Aufgabe, wenn diese Eingaben nicht mehr unerwartet die Befehle F3, F5 oder F1 auslösen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- desktop
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100