Name
protocol
Synopsis
T
.protocol(protocol_name
,callable
)
By calling protocol
with a first argument of
'WM_DELETE_WINDOW
' (the only meaningful protocol
on most platforms), you install callable
as the handler for attempts by the user to close
T
through the window manager (for example
by clicking on the X in the upper right corner on Windows and KDE).
Python then calls callable
without
arguments when the user makes such an attempt.
callable
itself must call
T
.destroy( )
in order
to close T
, otherwise
T
stays open. By default, if
T
.protocol
has not been
called, such attempts implicitly call
T
.destroy( )
and thus
unconditionally close T
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.