gpt4 book ai didi

python - tkinter 顶级小部件有哪些协议(protocol)

转载 作者:行者123 更新时间:2023-12-01 09:23:22 25 4
gpt4 key购买 nike

当使用 Tk.protocol 参数时可能是“WM_DELETE_WINDOW”、“WM_SAVE_YOURSELF”和“WM_TAKE_FOCUS”

但是还有其他的吗?

具体来说,在我的程序中,我想创建一个跟随另一个窗口的窗口

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('+')])))

如果 root 在屏幕上移动,我应该让“a”跟随“root”

我的实际问题是还有哪些其他协议(protocol)或者我在哪里可以找到它们

最佳答案

这是您正在寻找的答案:

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.)

来源:https://wiki.tcl.tk/8454

关于python - tkinter 顶级小部件有哪些协议(protocol),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50630793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com