是否可以创建一个没有框架和背景的 Tkinter 窗口? [英] Is it possible to create a Tkinter Window with no frame, and no background?

查看:34
本文介绍了是否可以创建一个没有框架和背景的 Tkinter 窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经浏览了文档,现在搜索了很多,但找不到这个问题的答案.在我放弃之前,我会在这里问.

I've looked through the documentation, and searched quite a bit now, and couldn't find an answer for this problem. Before I give up, I'll ask here.

我想创建一个没有框架的窗口(例如,没有标题栏,窗口周围没有边框),并且可能是透明背景.我已经找到了如何将背景设置为某种颜色,但不设置为透明的方法,并且找不到关于是否可以让框架不显示自身的任何信息.

I want to create a window that has no frame (as in, no titlebar, no border around the window), and maybe a transparent background. I've found how to set the background to a certain colour, but not to transparent, and couldn't find anything about whether I can have the frame not display itself.

所以我问,是否可以创建一个没有边框和透明背景的 Tkinter 窗口?

So I ask, is it possible to create a Tkinter window that has no border, and a transparent background?

推荐答案

没有边框是可能的.尝试使用 wm 瞬态或 wm overrideredirect 之类的方法.

No border is possible. Try something like wm transient or wm overrideredirect.

透明依赖,查看 wm 属性的文档:http://www.tcl.tk/man/tcl/TkCmd/wm.htm#M8 在 Windows 上,您可以设置透明颜色.

Transparent depends, have a look at the documentation for wm attributes: http://www.tcl.tk/man/tcl/TkCmd/wm.htm#M8 On windows you can set a transparentcolor.

否则,您可能需要特定于平台的扩展来创建形状奇特的透明窗口,例如:http://www.cs.man.ac.uk/~fellowsd/tcl/shapeidx.html

Otherwise you might need a platform specific extension to create oddly shaped and transparent windows, for example: http://www.cs.man.ac.uk/~fellowsd/tcl/shapeidx.html

这篇关于是否可以创建一个没有框架和背景的 Tkinter 窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆