Skip to content

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

Open

Description

@tangledhelix

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions