Ruby Tk "on top"

R

Rick Ashton

Hey

I've been wondering how to make a window fullscreen in Ruby Tk. I came
across this which is what I'm using now:

require 'tk'
r = Tk.root
r.withdraw
r.overrideredirect = true
r.deiconify
r.geometry = "#{r.winfo_screenwidth}x#{r.winfo_screenheight}+0+0"
Tk.root.state = 'zoomed'
Tk.mainloop

However, in OS X, this "fullscreen" window still sits behind the dock
and menu bar. Is there some way to tell the window manager to put this
"on top" of everything, even the dock and menu bar? I had a look through
the Tk wm reference but couldn't find anything very useful.

Thanks!
 
M

Morton Goldberg

I've only played around with Ruby Tk on OS X only a little, but my
feeling is that Tk has no concept of a window manager having a screen-
top menu bar rather than window-top menu bars. And I'm pretty sure it
had no concept of a OS X style dock. Therefore, I think you will have
to live with the following:

1. Hide the dock.
2. Adjust your window geometry to exclude the OS X menu bar area.

Not what you want, I admit. Perhaps someone more knowledgeable than
me will reply with a better idea.

Regards, Morton
 
R

Rick Ashton

I think the guys did a good job integrating Tk with the OS X GUI, the
menu bar items actually end up on top (try add a TkMenubar item, it'll
end up on top of the screen, and not on the window:) I don't think Tk
has to take the geometry of the native GUI into consideration, since all
it needs to do is request "on-top-ness" from the WM, regardless of what
the WM GUI is like, whether it's a dock, a taskbar, or a 3D virtual cube
:) But yes, if I don't find a real solution, the workaround would have
to be to hide the dock though some ugly hack (read Applescript... ugh!)
and resize the window accordingly.

Thanks!
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top