Tkinter 的非标准窗口? [英] Non-standard windows with Tkinter?

查看:40
本文介绍了Tkinter 的非标准窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用 Tkinter 创建非标准窗口?我想要在屏幕上有一个浮动图像,里面有 Tkinter 小部件.想想像 Mac 的 Growl、iPad 上的 Siri、Mac OS 音量/亮度改变边框等.如果这不可能,有没有办法摆脱窗口上带有标题的顶部栏并关闭/最小化/resize 按钮,并要求脚本完成(或修饰符-Q 键击)才能关闭?

Is there a way to create non-standard windows with Tkinter? I want something of a floating image on the screen, with Tkinter widgets inside. Think something like Growl for Mac, Siri on the iPad, Mac OS volume/brightness change bezels, etc. If this isn't possible, is there a way to get rid of the top bar on the window with the title and close/minimize/resize buttons, and require the script to complete (or modifier-Q keystroke) to close?

推荐答案

wm_overrideredirect 将删除标准窗口边框.你仍然会被一个矩形窗口卡住.您可以使用 wm_attributes 调整窗口的透明度(寻找alpha 属性),尽管这只适用于 Windows 和 Mac.

wm_overrideredirect will remove the standard window borders. You'll still be stuck with a rectangular window. You can adjust the transparency of the window with wm_attributes (look for the alpha attribute), though this only works on Windows and the Mac.

已经尝试过使用 tcl/tk 制作成形窗口,您可能可以使用 Tkinter,尽管它需要编译一些代码.请参阅 tcl'ers wiki 上的 管理和塑造顶层.

There have been attempts at shaped windows with tcl/tk, which you might be able to get to work with Tkinter, though it requires compiling some code. See Managed and shaped toplevel on the tcl'ers wiki.

这篇关于Tkinter 的非标准窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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