开发者

How do I get a windows border like this in Tkinter?

开发者 https://www.devze.com 2023-01-08 17:00 出处:网络
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.

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.

How do I get a windows border like this in Tkinter?

开发者_如何转开发

This is in windows 7, btw.


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.

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.


The WS_DLGFRAME window style should give you a window without a titlebar and WS_EX_TOOLWINDOW is normally also used for a window like this so it is not visible in the taskbar (Or with a hidden parent window like control panel dialogs before Vista) You can figure out the exact window styles with a tool like Spy++ (Visual Studio) or WinSpy++

0

精彩评论

暂无评论...
验证码 换一张
取 消