tags:

views:

42

answers:

2

Is it possible to create some kind of fullscreen mode (e.g. no window title bar) in Tk applications?

+2  A: 

Yes. You wan to set the overrideredirect flag on a toplevel.

toplevel .top
wm overrideredirect .top 1

If you run this interactively you need to withdraw the window and them deiconify it so that the window manager has a chance to remove the frame from the window.

This only removes the window manager decorations. You need to manage the size as a separate step in the normal way.

For more information see the man page on the wm command

Bryan Oakley
+2  A: 

I used to use the wm overrideredirect trick in my code. Recently I found it to be buggy on Ubuntu. Not sure why, maybe a gnome issue, maybe a glx issue. Currently I'm using:

wm attributes . -fullscreen 1

which so far works on Windows and Linux. Haven't tested on Mac although I don't see why it wouldn't work.


OK read the man page. It says it works on Windows, OSX (Quartz) and X11.


Additional info

for those who didn't believe me

The man page says:

 -fullscreen
         Places the window in a mode  that  takes  up  the  entire
         screen,  has  no borders, and covers the general use area
         (i.e. Start menu and taskbar on Windows, dock and menubar
         on OSX, general window decorations on X11).

which seems to imply that the window decorations (title bar etc) is removed in -fullscreen mode. And in my real-world experience (I just checked my code 2 seconds ago) that seems to be the case on Windows and Ubuntu (linux). Don't know if it's true for OSX but the man page says it should be.

If this is ever not true on any platform then I believe it is a bug in the documentation. In which case it should be noted in the man page clearly on which platform are window decorations not removed.

slebetman
What you propose doesn't remove the window title bar, a requirement that is part of the original question.
Bryan Oakley
Really? It removes the title bar on my machine. `wm attribute . -zoomed 1` doesn't remove the title bar, `-fullscreen` on the other hand removes all decorations.
slebetman
Note: When I say on my machine I mean on both Ubuntu and WindowsXP
slebetman
@slebetman: I stand corrected. On my mac it doesn't remove the titlebar, but maybe that's a bug that's been fixed in later versions. Thanks for clarifying!
Bryan Oakley
When you say Mac do you mean Classic or OSX? The manual only mentions OSX and newer features of Tk doesn't really support Classic anymore.
slebetman
@slebetman: OSX. 10.6.4 to be exact.
Bryan Oakley
Works great!!!!
Karsten W.
@Bryan: It does remove titlebar and dock (well, does when I test) but *only* when the window has the focus/is activated.
Donal Fellows