Tkinter fullscreen with Mac OS X

C

C Martin

Is there a way to create a full screen app using Tkinter with Mac OS
X?? On windows, this is relatively easy with overrideredirect(1).
However, on the Mac, the top menu bar and dock are still displayed
over the app. Is there a way to get rid of them?

Thanks.
 
G

Guilherme Polo

Is there a way to create a full screen app using Tkinter with Mac OS
X?? On windows, this is relatively easy with overrideredirect(1).
However, on the Mac, the top menu bar and dock are still displayed
over the app. Is there a way to get rid of them?

You could try this, supposing tl is a toplevel:

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

and if you are using python with tk 8.5 or newer (unlikely):

tl.wm_attributes('-fullscreen', 1)

But I don't have a mac, so I can't say for sure if these solve your problem.
 
C

C Martin

You could try this, supposing tl is a toplevel:

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

I tried this (although, my tl is actually a tk instance):

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

and get this message:

Traceback (most recent call last):
File "./ProgramCountdown.py", line 120, in <module>
control = Controller(tk)
File "./ProgramCountdown.py", line 37, in __init__
self.tk.call("::tk::unsupported::MacWindowStyle", "style",
self.tk._w, "plain", "none")
_tkinter.TclError: bad class: should be alert, moveableAlert, modal,
moveableModal, floating, help, or document

Any thoughts? Can you do something similar on the tk instance itself?
 
K

Kevin Walzer

C said:
I tried this (although, my tl is actually a tk instance):

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

and get this message:

Traceback (most recent call last):
File "./ProgramCountdown.py", line 120, in <module>
control = Controller(tk)
File "./ProgramCountdown.py", line 37, in __init__
self.tk.call("::tk::unsupported::MacWindowStyle", "style",
self.tk._w, "plain", "none")
_tkinter.TclError: bad class: should be alert, moveableAlert, modal,
moveableModal, floating, help, or document

Any thoughts? Can you do something similar on the tk instance itself?


Try something like this (assuming self.tk._w is the name of your window):

self.tk._w.wm_attributes(fullscreen='true')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top