Python Tkinter wm_属性在Linux中没有所有选项
我想在Linux(Python3.x)中用Tkinter创建一个GUI。当我尝试执行以下操作时:-Python Tkinter wm_属性在Linux中没有所有选项,python,python-3.x,linux,user-interface,tkinter,Python,Python 3.x,Linux,User Interface,Tkinter,我想在Linux(Python3.x)中用Tkinter创建一个GUI。当我尝试执行以下操作时:- from tkinter import * import tkinter root = Tk() root.overrideredirect(True) # Hide the cross button and that bar root.wait_visibility(root) root.call("wm", "attributes", ".
from tkinter import *
import tkinter
root = Tk()
root.overrideredirect(True) # Hide the cross button and that bar
root.wait_visibility(root)
root.call("wm", "attributes", ".", "-transparent", "true")
root_w = 190
root_h = 190
win_w = root.winfo_screenwidth()
win_h = root.winfo_screenheight()
root.geometry(f'{root_w}x{root_h}+{win_w - root_w - 40}+{win_h - root_h - 40}')
samplabl = Button(root, text=f"WIDTH: {win_w} HEIGHT: {win_h}", bg='#ffffff')
samplabl.pack()
root.mainloop()
这就是我得到的:-
Traceback (most recent call last):
File "/home/bravo6/Desktop/Stella__Compilative/GUI/temp.py", line 8, in <module>
root.call("wm", "attributes", ".", "-transparent", "true")
_tkinter.TclError: bad attribute "-transparent": must be -alpha, -topmost, -zoomed, -fullscreen, or -type
回溯(最近一次呼叫最后一次):
文件“/home/bravo6/Desktop/Stella__compileative/GUI/temp.py”,第8行,在
root.call(“wm”、“attributes”、“transparent”、“true”)
_tkinter.TclError:错误属性“-transparent”:必须为-alpha、-top、-zomed、-fullscreen或-type
看起来
wm\u属性
无法识别-透明
属性。。。它似乎只在Windows下工作。你知道如何在Linux中实现这一点吗?你无能为力。不同的操作系统支持不同的窗口管理器选项。在撰写本文时,以下是每个窗口系统支持的属性:
所有平台:alpha
,全屏
,最顶层
OSX:修改
,通知
,标题路径
,透明
窗口:禁用
,工具窗口
,透明颜色
基于X11的系统(即:linux,并且仅适用于某些窗口管理器):
键入
,缩放
考虑到某些属性,它们可能在某些操作系统上不可用。根据,-透明
仅适用于Mac。如果你只是想要一个透明/透明的窗口,可以玩-alpha
?是的。。。我也这么想!我做了些调整,但还是没用。。。不过非常感谢!