0

The code below is a section of a project I am working on in tkinter. When I call the `-fullscreen=True, the close out button in the top right disappears. Is there any way to fix this?

def homeScreen():

    global home

    home = Tk()
    home.attributes("-fullscreen", True)

    listButton = Button(home, text = 'Listify', command = listifyScreen)
    enterButton = Button(home, text = 'No Enter', command = enterScreen)
    #separateButton = Button(home, text = 'Separate', command = separateScreen)

    listButton.pack()
    enterButton.pack()

    home.mainloop()

homeScreen()
Miraj50
  • 4,257
  • 1
  • 21
  • 34

2 Answers2

1

Rather than setting your tkinter home screen to fullscreen (which does what it is meant to do and removes the min/max and close buttons) just set your tkinter home screen size to match your screen resolution.

You can do this by using home.minsize(width=screenWidth, height=screenHeight) right after home = Tk().

I hope this helps!

Note: if you are using windows, do check the display settings for scale and layout options. If they're set to something different than 100%, do rescale your screenWidth and screenHeight accordingly.

0

If you want to make you Application Window to be full-screen at starting you can follow this process:

import tkinter as tk

class MainWindow:
    def __init__(self, master):
        self.master = master
        self.master.title("Window Title")
        self.master.wm_iconbitmap('icon.ico')

        # --- This is the code you need --- #
        screen_width = str(self.master.winfo_screenwidth())
        screen_height = str(self.master.winfo_screenheight())
        self.master.geometry(screen_width + "x" + screen_height + "+0+0")

        self.listButton = tk.Button(self.master, text='Listify')
        self.listButton.grid(row=0, column=0, padx=4, pady=4)

        self.enterButton = tk.Button(self.master, text='No Enter')
        self.enterButton.grid(row=1, column=0, padx=4, pady=4)
        # ---  --- #

def main():
    root = tk.Tk()
    app = MainWindow(root)
    root.mainloop()
if __name__ == '__main__':
    main()
Partho63
  • 3,117
  • 2
  • 21
  • 39