如何在 Tkinter 中获得这样的窗口边框? [英] How do I get a windows border like this in Tkinter?

查看:32
本文介绍了如何在 Tkinter 中获得这样的窗口边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Tkinter 中获得这样的边框?请注意它如何缺少右上角的按钮.另外我不希望这个程序显示在任务栏中.

Is there any way to get a border like this in Tkinter? Notice how it lacks the buttons on the top right. Also I don't want this program to show in the task bar.

顺便说一下,这是在 Windows 7 中.

This is in windows 7, btw.

推荐答案

Tk(因此,Tkinter)有一个命令用于删除所有窗口管理器装饰.tkinter 中的这个命令是顶层窗口的wm_overrideredirect"方法.将参数 True 传递给它以删除窗口管理器装饰.然后您可以绘制任何您想要的边框,通常是在整个窗口上打包一个画布并在画布上绘制.

Tk (and thus, Tkinter) has a command for removing all window manager decoration. This command in tkinter is the "wm_overrideredirect" method of toplevel windows. Pass it a parameter of True to remove the window manager decorations. You can then draw whatever borders you want, usually by packing a canvas over the entire window and drawing on the canvas.

但是,当我在 Mac 上对此进行试验时,该窗口正确显示但无法获得焦点.也许这是 Tkinter 中的一个错误.我在 Tcl 中没有看到相同代码的相同问题.

However, when I experiment with this on my Mac, the window appears properly but won't take focus. Perhaps this is a bug in Tkinter. I don't see the same problem with identical code in Tcl.

这篇关于如何在 Tkinter 中获得这样的窗口边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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