python / python/cpython

tkinter: Unexpected behavior caused by Chinese input method

Aberta
#125,349 18 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

stdlib topic-tkinter
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece com as associações de eventos do tkinter do editor IDLE no Windows e reproduza o comportamento usando o método de entrada chinês com r, t e p seguidos de Enter. Compare event.char com event.keysym, keycode e keysym_num e analise o PR vinculado gh-125352. A tarefa estará concluída quando essas entradas não acionarem mais inesperadamente os comandos F3, F5 ou F1.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
desktop
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.