3

I am just learning python, and I am trying to make a window go full screen, which I have achieved, but I am now wanting to get rid of the title bar across the top. It currently looks like the image below, but I want it to also go over the Mac top toolbar at top (like a splash screen).

enter image description here

from tkinter import *
root = Tk()

root.attributes('-fullscreen', True)
root.attributes('-topmost', True)
root.overrideredirect(True)



def quitApp():
    # mlabel = Label (root, text = 'Close').pack()
    root.destroy()

# placing the button on my window
button = Button(text = 'QUIT', command = quitApp).pack()
Knowledge Cube
  • 990
  • 12
  • 35
BCLtd
  • 1,459
  • 2
  • 18
  • 45
  • There is [overrideredirect](https://stackoverflow.com/questions/38162932/what-does-overrideredirect-do) method that works with windows but not sure how/if it works on mac. – Lafexlos Jun 02 '17 at 12:22
  • I tried that but didnt do anything (maybe I done wrong) – BCLtd Jun 02 '17 at 12:22

1 Answers1

5

I believe what you want to do is use

root.wm_attributes('-fullscreen','true')

Try this instead. It should do the trick.

from tkinter import *
root = Tk()

root.wm_attributes('-fullscreen','true')

def quitApp():
    root.destroy()

button = Button(text = 'QUIT', command = quitApp).pack()

root.mainloop()

If this does not work because of the MacOS then take a look at this link This useful page has sever examples of how to manage mack windows in tkinter. And I believe what you may need to get borderless fullscreen.

This bit of code might be what you need:

root.tk.call("::tk::unsupported::MacWindowStyle", "style", root._w, "plain", "none")

Note: If you do use this option then you will need to remove root.wm_attributes('-fullscreen','true') from your code or just comment it out.

Update:

There is also another bit of code for tkinter 8.5+.

If you are using python with tkinter 8.5 or newer:

root.wm_attributes('-fullscreen', 1)
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79
  • Hi, that gets rid of the Mac tool bar (if thats what its called), but still shows the app title bar – BCLtd Jun 02 '17 at 13:08