使用未装饰的窗口启动 Tkinter [英] Launch Tkinter with undecorated window

查看:27
本文介绍了使用未装饰的窗口启动 Tkinter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Python 2 和 Tkinter,如何在窗口上方没有标题栏的情况下启动 Tk 窗口?

Using Python 2 and Tkinter, how can I make the Tk window launch without the title bar above the window?

from Tkinter import *

root = Tk()
frame = Frame(root)
frame.pack()

bottomframe = Frame(root)
bottomframe.pack( side = BOTTOM )

redbutton = Button(frame, text="Red", fg="red")
redbutton.pack( side = LEFT)

greenbutton = Button(frame, text="Brown", fg="brown")
greenbutton.pack( side = LEFT )

bluebutton = Button(frame, text="Blue", fg="blue")
bluebutton.pack( side = LEFT )

blackbutton = Button(bottomframe, text="Black", fg="black")
blackbutton.pack( side = BOTTOM)

root.mainloop()

推荐答案

您可以使用 从 Tkinter 窗口(TkToplevel)中删除所有装饰="http://effbot.org/tkinterbook/wm.htm#Tkinter.Wm.overrideredirect-method" rel="nofollow">.overrideredirect():

You can remove all decoration from a Tkinter window (Tk or Toplevel) by using .overrideredirect():

root = Tk()
root.overrideredirect(True)

这篇关于使用未装饰的窗口启动 Tkinter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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