参数和参数是什么?可用于Tkinter窗口管理器的选项?
此Q& A适用于那些难以使用窗口管理器并找到有关如何正确使用它的所有信息的人。如果我犯了任何错误或错过了某些内容,请随时编辑/评论。
答案 0 :(得分:3)
以下是如何使用wm(窗口管理器)调用函数的快速概述:
#!/usr/bin/python3
from Tkinter import *
frame = Tk()
frame.overrideredirect(1) # Remove shadow & drag bar. Note: Must be used before wm calls otherwise these will be removed.
frame.call("wm", "attributes", ".", "-topmost", "true") # Always keep window on top of others
frame.geometry("100x100+500+500") # Set offset from top-left corner of screen as well as size
frame.call("wm", "attributes", ".", "-transparent", "true") # Remove shadow from window
frame.call("wm", "attributes", ".", "-fullscreen", "true") # Fullscreen mode
frame.call("wm", "attributes", ".", "-alpha", "0.9") # Window Opacity 0.0-1.0
frame.call("wm", "attributes", ".", "-modified", "0.9") # Toggles modified state of the close-window icon.
frame.mainloop()
"。"是'路径'到窗口名称,以防它是另一个窗口的子项。例如,如果是窗口" myFrame"有个孩子打电话给#34; popup"然后路径将读作" myFrame.popup"。值true和false可分别替换为1和0。注意:1和0不需要引号。
详细了解wm属性here以及哪些属于哪个平台。有些仅适用于Windows。