删除Python标题

2024-06-28 10:53:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我在找很长时间来解决这个问题。我想删除Tk窗口的标题栏,就像函数“overridedirect()”。我的问题是,操作系统的任务栏上没有图标。 我也试过了”根.属性(“-fullscreen”,1)“并试图缩小它,但这也不起作用。 我希望有人知道一个好的解决办法,谢谢你的帮助!在

我的代码现在看起来像这样:

from tkinter import *

class Main(Frame):
    def __init__(self, root):
**...**
#There are more classes after this one, but defined the same way

def main():
    root = Tk()
    root.geometry("800x400+0+0")
    root.minsize(700, 400)
    root.title("Title")
    #root.overrideredirect(True)
    #root.iconify()
    ##root.attributes('-topmost', 1)
    ##root.attributes("-fullscreen",  1)
    ##root.wm_state("zoomed")

if __name__ == "__main__":
    main()

Tags: 函数代码from属性maindefrootattributes