python / python/cpython

tkinter: Unexpected behavior caused by Chinese input method

Đang mở
#125,349 18 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

stdlib topic-tkinter
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với các liên kết sự kiện tkinter của trình soạn thảo IDLE trên Windows và tái hiện hành vi bằng phương thức nhập tiếng Trung với r, t và p, sau đó nhấn Enter. So sánh event.char với event.keysym, keycode và keysym_num, đồng thời xem xét PR liên quan gh-125352. Hoàn tất khi các đầu vào này không còn bất ngờ kích hoạt các lệnh F3, F5 hoặc F1.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
desktop
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.