Python 3.x-在Tkinter中切换全屏 [英] Python 3.x - toggling fullscreen in tkinter
本文介绍了Python 3.x-在Tkinter中切换全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
到目前为止,我有一个使窗口全屏显示的命令.现在,可以预见的是,我也希望能够退出全屏显示.
So far, I have a command that makes my window fullscreen. Now, predictably, I want to be able to exit fullscreen also.
这是我的代码:
def toggFullscreen(self, win):
def exitFullscreen(event=None):
win.withdraw()
win.deiconify()
win.overrideredirect(False)
win.geometry('1024x700')
w = win.winfo_screenwidth()
h = win.winfo_screenheight()
win.overrideredirect(True)
win.geometry('%dx%d+0+0' % (w, h))
win.focus_set()
win.bind('<Escape>', exitFullscreen)
但是问题是我无法重新显示窗框.我以为执行win.overrideredirect(False)
可以,但是没有.
But the issue is that I can't get the window frame to reappear. I thought that doing win.overrideredirect(False)
would work, but it didnt.
推荐答案
在调用withdraw
和deiconify
之前在 之前更改overrideredirect
标志.
Change the overrideredirect
flag before calling withdraw
and deiconify
.
这篇关于Python 3.x-在Tkinter中切换全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文