首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Tkinter wm_attributes并不是Linux中的所有选项。

Tkinter wm_attributes并不是Linux中的所有选项。
EN

Stack Overflow用户
提问于 2020-12-08 09:13:58
回答 1查看 789关注 0票数 3

我想在Linux中用Tkinter创建一个GUI (Python3.x)。当我试图执行以下操作时:

代码语言:javascript
运行
复制
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()

这就是我得到的:-

代码语言:javascript
运行
复制
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

看来wm_attribute不认识-transparent属性..。它似乎只适用于Windows。知道如何在Linux中工作吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-08 14:34:49

你无能为力。不同的操作系统支持窗口管理器的不同选项。在我编写这篇文章时,以下是每个窗口系统所支持的属性:

alphafullscreentopmost OSXmodifiednotifytitlepathtransparent E 111WindowsE 212disabledd14、transparentcolor E 116基于X11的系统E 217(即: linux,只包含一些窗口管理器):type、zoomed

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65196133

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档