macOS "Hide" handled improperly in tkinter with Tk >= 9.0

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

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

Hướng nghiên cứu

Start by tracing how tkinter integrates with Tk on macOS and handles the OS-level Hide command; the report gives a minimal reproduction using tkinter.Tk() and mainloop(). Compare behavior with Tk 8.6 and Tk 9.1 on macOS, then identify the relevant implementation and test locations. Done means Cmd-H or the menu Hide hides the window instead of leaving it visible and unfocused.

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

Mô tả

topic-tkinter type-bug
Bug report

Using the macOS OS-level "Hide" feature misbehaves. Rather than hiding the window(s) as expected, tkinter apps are pushed to the background and lose focus to another app. This only seems to happen with Tk >= 9.0; using an older Tk 8.6-based tkinter doesn't have this bug.

This is easy to reproduce. Run the below. It's easiest to test if there's not much clutter on the screen; a simple test case is a terminal to run Python in and clear other apps from the desktop.

import tkinter as tk; r = tk.Tk(); r.mainloop()

After the tkinter window pops up, try to hide (using "Hide" in the menu or Cmd-H). The tkinter app will defocus but remain on-screen, focus will shift to another app (probably the terminal).

❯ python3 --version
Python 3.15.0

>>> import tkinter
>>> tkinter.TkVersion
9.1
CPython versions tested on:

3.15, 3.14, 3.13

Operating systems tested on:

macOS

Ngôn ngữ chính
Python
Star
78.2k
Fork
36.6k
Merge trung bình
19 giờ 57 phút
Pull request đã merge (30 ngày)
630

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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.

Issue khác của python/cpython

Tất cả issue của python/cpython

Issue tương tự

Thêm issue về Python

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.