在 Python 中重新最大化 Tkinter 窗口 [英] Remaximize Tkinter window in Python

查看:30
本文介绍了在 Python 中重新最大化 Tkinter 窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以阻止用户最小化 Python Tkinter 窗口?或者也许只是有一个函数来检查它是否被最小化以及是否再次最大化.

Is is possible to stop a user from minimizing a Python Tkinter window? Or maybe just have a function that checks to see if it is minimized and if it is maximize it again.

到目前为止我可以用这种方法实现全屏窗口

So far I can achieve a full screen window with this method

from Tkinter import *

root = Tk()
sw = root.winfo_screenwidth()
sh = root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (sw, sh))
root.mainloop()

推荐答案

您可以捕获 事件并取消图标化窗口:

You can catch the <Unmap> event and deiconify the window :

root.bind("<Unmap>", lambda e: root.deiconify())

您还可以防止调整窗口大小:

You can also prevent your window from being resized :

root.resizable(FALSE,FALSE)

这篇关于在 Python 中重新最大化 Tkinter 窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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