Reputation: 59
Im trying to make the user use fullscreen then have the ability to minimise their screen, is there a way to do that in Tkinter? this is my code for the main window
def home():
mainbody = Tk() # main body
mainbody.geometry("1300x800") # size of window
mainframe = Frame(mainbody)
mainframe.grid()
Button(mainframe, bg="RoyalBlue2", width=12, text="Desktop", command=desktop).grid(row=0, column=0)
and i want the user to be able to press "Desktop" which will minimise the window without to press a button to go back to full screen or atleast a larger size
def desktop():
goodbye_screen = Tk()
goodbye_screen.geometry("300x300")
Label(goodbye_screen, text="Goodbye!").grid()
goodbye_screen.withdraw()
Upvotes: 2
Views: 423
Reputation: 219
Here is a quick solution I made for your problem. Also, I don't know if you intended to do this but if you keep on repeating (variable) = Tk()
, the windows are going to conflict.
from tkinter import *
window = Tk()
def desktop():
Label(window, text="Goodbye!").grid()
window.wm_state('iconic')
def home():
window.geometry("1300x800") # size of window
mainframe = Frame(window)
mainframe.grid()
Button(mainframe, bg="RoyalBlue2", width=12, text="Desktop", command=desktop).grid(row=0, column=0)
home()
Upvotes: 2