Tkinter的窗口管理器有哪些可用的参数和选项?
该问答适用于那些难以使用窗口管理器并找到所有有关如何正确使用它的信息的人。如果我有任何错误或遗漏,请随时进行编辑/评论。
这是有关如何使用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()
Run Code Online (Sandbox Code Playgroud)
“。” 如果它是另一个窗口的子级,则为窗口名称的“路径”。例如,如果窗口“ myFrame”有一个名为“ popup”的子级,则路径将显示为“ myFrame.popup”。值true和false可以分别替换为1和0。注意:1和0不需要引号。
在此处了解有关wm属性的更多信息,以及哪些属性适用于哪个平台。有些仅适用于Windows。
| 归档时间: |
|
| 查看次数: |
5115 次 |
| 最近记录: |