Grab#

A grab routes all input events to one widget (and its descendants), which is how a modal dialog blocks the rest of the application until it is dismissed.

The canonical upstream reference is the Tk grab manual page (Tcl 8.6).

grab_set()

Make this widget the local grab holder: events for this application are directed to it and its descendants until the grab is released.

Returns:

None.

grab_set_global()

Make this widget the global grab holder: events for the whole screen — every application — are directed to it. Use rarely; it locks out the user’s other windows.

Returns:

None.

grab_release()

Release this widget’s grab.

Returns:

None.

grab_current()

Return the widget in this application that currently holds a grab.

Returns:

the grab holder, or None if there is none.

Return type:

Misc | None

grab_status()

Report this widget’s grab state.

Returns:

"local", "global", or None if this widget has no grab.

Return type:

str | None