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

Aperta
#161,848 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
desktop

Direzione di ricerca

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.

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

Descrizione

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

Lingua principale
Python
Stelle
78.2k
Fork
36.6k
Merge medio
19h 57m
PR unite (30g)
630

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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.

Altre issue di python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.