On 11 Mar 2003 at 13:46, nagai / ai.kyutech.ac.jp wrote:

> From: kryptik / usa.com

> > Is there a way to set a background img or color to your root window? 
> > I would like to use a img or color to give my app a desktop like feel. 
> > Is it possible, or is this something tk is lacking?
> 
> Well, maybe need a little tricky way. 
> The way is to use two geometry manager on same widget. 

Hmm. That doesn't seem like a very good idea. First of all, to the 
extent that this trick works it is incidental, undocumented behavior 
of the current implementation, thus subject to change without notice. 
And I'm surprised that it would work at all. I'm fairly new to Ruby, 
but have done a lot of Tcl/Tk and Tkinter (Python) work, and in those 
languages if you use two geometry managers on the same widget it will 
at least freeze up your application, and sometimes your whole 
desktop. Maybe Ruby handles geometry manager conflicts more 
gracefully.

In any case, I think there's another way to do this.

  1. Create a toplevel window without title bars and all that junk (I 
      forget exactly how you do that, but it's documented ... search 
      the Wm manual page for "override redirect." That should at 
      least be a start.
  2. Display your image in the window.
  3. Lower the window ("down" being towards the root window, of 
      course).
  *  You may need to set a binding on the window such that it gets 
      lowered again every time it becomes visible.

How well this technique works may depend on how well-behaved your 
window manager is, but at least it relies on documented, intentional 
features of Tk.

--
Matt Gushee
Englewood, CO, USA