问题描述
我使用的是最新版本的 Mac OS 和 Python 3.9。我尝试使用 overrideredirect 删除标题栏并添加我自己的标题栏。但是,结果不会显示该窗口。该应用程序显示在 Dock 和菜单栏中。但是不显示。
我的代码:
from tkinter import *
root = Tk()
def move_window(event):
root.geometry('+{0}+{1}'.format(event.x_root,event.y_root))
root.overrideredirect(True)
root.geometry('400x100+200+200')
title_bar = Frame(root,bg='white',relief='raised',bd=2)
close_button = Button(title_bar,text='X',command=root.destroy)
window = Canvas(root,bg='black')
title_bar.pack(expand=1,fill=X)
close_button.pack(side=RIGHT)
window.pack(expand=1,fill=BOTH)
title_bar.bind('<B1-Motion>',move_window)
root.mainloop()
相同的代码在 Windows 中运行良好。
提前致谢! :)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)