如何在不删除/禁用关闭按钮的情况下删除/禁用最小化按钮
我正在使用Python中的TKINTER构建一个简单的登录系统,因为我需要一个不可避免的登录系统,并且可以通过'可重新设备(0,0)来完成,但它仅禁用最大化按钮。但是,我也将最小化的按钮也被禁用,所以请有人帮助我找到这些解决方案。
这是我的代码的示例,
from tkinter import *
root = Tk()
root.geometry("400x300")
def signIn():
# Opening a new window for SignIn options
signin = Toplevel()
signin.grab_set()
signin.focus_set()
# I also tried this but it removes the whole title bar along with the close 'X' button
# root.overrideredirect(True)
# SignIn button
button = Button(root, text="Sign In", command=signIn)
button.grid(row=1, column=0)
root.mainloop()
I am building a simple login system using Tkinter in python, for that I need a non-resizable and it can be done by 'resizable(0,0) but it only disables the maximize button. But I what the minimize button to be disabled also, so please someone help me find the solution for these.
Here's the sample of my code,
from tkinter import *
root = Tk()
root.geometry("400x300")
def signIn():
# Opening a new window for SignIn options
signin = Toplevel()
signin.grab_set()
signin.focus_set()
# I also tried this but it removes the whole title bar along with the close 'X' button
# root.overrideredirect(True)
# SignIn button
button = Button(root, text="Sign In", command=signIn)
button.grid(row=1, column=0)
root.mainloop()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想禁用最小化和最大化,请使用此功能。它将只剩下 x 按钮。我给出了仅删除最大化的示例,然后给出了同时删除最大化的示例。
If you want to disable the minimize and maximize use this. It will leave you with only the x button. I gave example for only removing maximize and then one for both.
使用 root.wm_attributes('-type', '工具栏')
use
root.wm_attributes('-type', 'toolbar')