How to catch the maximization signal in Tk?

You can bind the command using the X button of the window:

wm protocol $windowPath WM_DELETE_WINDOW $command

How can I do the same for the maximize window button?

+3
source share
1 answer

There is no standard protocol for it, either from the X11 ICCCM set , or Install FreeDesktop . Therefore, wm protocolit cannot be used for this. However, you can use the event <Configure>to track all size changes for the window. Please note that if you install it at the top level, you will also receive notifications about all widgets inside this window, so you should check if the event was actually up to the level before acting on it, perhaps like this:

bind $toplvl <Configure> {
    if {"%W" eq [winfo toplevel "%W"]} {
        ActOnResize %W %w %h [wm attributes %W -zoomed]
    }
}

You can also check the attribute -fullscreen.

+2
source

Source: https://habr.com/ru/post/1784462/


All Articles