Of course, I should've noticed the word "layout" in your original email.
Your problem reminds me of collision detection in 2D video games.  I found
this tutorial to be helpful:
http://www.metanetsoftware.com/technique/tutorialA.html .  Basically, if
two objects are overlapping, you calculate a push vector between their
centroids to separate them.

The other thing it sounds like is autoplacement in PCB layout programs.
The algorithms I've seen first expand the outline of each component a
little bit, then shuffle them all around using simulated annealing or a
similar algorithm to make them fit nicely.  But those algorithms don't aim
to please the eye; they don't line up edges or anything like that.

On Tue, Mar 6, 2012 at 9:20 AM, Adam Tauno Williams
<awill...@whitemice.org>wrote:

> On Tue, 2012-03-06 at 09:05 -0700, asom...@gmail.com wrote:
> > If you pack your widgets into boxes or tables, then they will never
> > overlap (unless you're using buggy 3rd party widgets).  Normally, the
> > only way to make widgets overlap would be to use a Layout or a Fixed
> > to manually place your widgets.  But that's generally a bad idea.  I
> > recommend that you read
> > http://www.pygtk.org/pygtk2tutorial/ch-PackingWidgets.html and pack
> > your widgets into boxes.
>
> I'm very much aware of widget packing.  But having widgets that can be
> deliberately dragged around on a surface [Layout] is specifically the
> purpose in this case.
>
> > On Tue, Mar 6, 2012 at 8:14 AM, Adam Tauno Williams
> > <awill...@whitemice.org> wrote:
> > This isn't specifically related to Gtk / PyGtk, but since I'm using
> > PyGTK I thought I'd ask it here [it just relates generally to UI
> > design].
> > If I have a layout that contains widgets [which are rectangles]
> > detecting with widgets overlap isn't that hard.  But is there a
> > generally accepted scheme / algorthym for redistributing the widgets
> > in such a fashion that they no longer overlap and 'feels' intuitive?
> > I've seen this behavior in a couple of applications and am curious if
> > ther is anything like a 'standard' approach to this issue? [relevant
> > links?]
>
>
> --
> System & Network Administrator [ LPI & NCLA ]
> <http://www.whitemiceconsulting.com>
> OpenGroupware Developer <http://www.opengroupware.us>
> Adam Tauno Williams
>
> _______________________________________________
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to