[GRASS-dev] Python GUI toolkits

Glynn Clements glynn at gclements.plus.com
Mon Jun 12 04:27:21 EDT 2006


Michael Barton wrote:

> > Personally, I like tools like Jedit that allow you to "latch" windows
> > together so that they act and move together (and remember where they
> > were put when you launch them next time). I don't like windows popping
> > up all over the place in random locations.
> 
> Sounds good, but I don't know how to do it. Maybe in the new system?

Attaching top-level windows to each other isn't really practical. 
Depending upon how cooperative the WM wants to be, implementing this
is somewhere between difficult and impossible. Implementing it on all
of X11, Windows and MacOSX is likely to be nearer the "impossible" end
of the scale.

OTOH, "docking" panels (allowing them to be "torn off" into a separate
top-level window or "swallowed" into an existing window) is more
straightforward.

Some toolkits provide explicit support for this (e.g. GtkHandleBox);
some even allow windows from one application to be docked in another
(e.g. GtkPlug/GtkSocket[1]).

[1] However, the documentation notes that "The GtkPlug and GtkSocket
widgets are currently not available on all platforms supported by
GTK+", which probably means "only available on X11".

If the toolkit doesn't provide explicit support, the usual solution is
to simply destroy the panel and re-create it in its new parent. If the
code is sufficiently modularised, this is usually straightforward.

[At least, the tearing-off aspect is. Swallowing a top-level based
upon its position can get a bit messy; it's easier if you leave behind
a "handle" which can be used instead.]

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list