开发者

Fullscreen mode with Tk

Is it po开发者_C百科ssible to create some kind of fullscreen mode (e.g. no window title bar) in Tk applications?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜