python / python/cpython

tkinter: Unexpected behavior caused by Chinese input method

Aperta
#125,349 18 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib topic-tkinter
Lingua principale
Python
Stelle
77.2k
Fork
36k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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:

2024-10-12-15-06-39

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con i binding degli eventi tkinter dell’editor IDLE su Windows e riproduci il comportamento usando il metodo di input cinese con r, t e p seguiti da Enter. Confronta event.char con event.keysym, keycode e keysym_num e analizza la PR collegata gh-125352. Il lavoro è completato quando questi input non attivano più inaspettatamente i comandi F3, F5 o F1.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
desktop
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.