Focus Callback

property Window.focus_callback: callable

Callback executed when the window gains input focus.

It receives a bool representing whether the window gained or lost input focus.

On most platforms, this means that the callback is called when the user minimizes a window, clicks on a window to make it active, or other similar actions.

def focus_callback(focused: bool) -> None:
    # code here
Raises
  • TypeError – callback must be callable

  • ValueError – callback function must take 1 argument

Return type

callable