Superior
Superior

Reputation: 885

What protocols of tkinter toplevel widget are there

When using Tk.protocol arguments could be “WM_DELETE_WINDOW”, “WM_SAVE_YOURSELF” and “WM_TAKE_FOCUS”

But is there any else.

Concretely, in my program, I want to create a window that follows another window

root = Tk()
root.config(width = 100, height = 100
a = Tk()
a.overredirect()
#here I just make window stand below bottom left corner of original window
#I succeded in doing that, but it is not ellegant at all and partially functional
#does anybody knows how to do it better
#note: this is not the main problem
a.geometry('%ix40+%s+%s' % (180,
                            int(g[g.index('+')+1:g.rindex('+')]) + 8,
                            int(g[g.rindex('+')+1:]) + 51 +
                            int(g[g.index('x')+1:g.index('+')])))

and here I should make "a" follow "root" if root moves on the screen

My actual question what other protocols are there or where can I find them all

Upvotes: 1

Views: 2381

Answers (1)

Olivier Samson
Olivier Samson

Reputation: 703

Here is the answer you are looking for :

Q. Is there a way of getting a list of available protocols for wm protocol? The man pages only list the obvious / common ones (WM_DELETE_WINDOW, WM_SAVE_YOURSELF, and WM_TAKE_FOCUS).

A. Those are the only three defined by the ICCCM; the freedesktop.org [EWMH] spec also defines _NET_WM_PING.

Note that WM_SAVE_YOURSELF is deprecated, and Tk apps can't implement WM_TAKE_FOCUS or _NET_WM_PING correctly, so WM_DELETE_WINDOW is the only one that should be used.

DKF: Tk now handles _NET_WM_PING for you by itself in the correct way; you'll never see this one at the script level. (The purpose of the protocol is to let other clients — especially a window manager or session manager — determine positively whether the application is processing events. That puts its implementation correctly buried in the guts of Tk.)

Source : https://wiki.tcl.tk/8454

Upvotes: 2

Related Questions