[pygtk] Design / Algorythym Question
Adam Tauno Williams
awilliam at whitemice.org
Thu Mar 8 20:23:45 WST 2012
Quoting asomers at gmail.com:
> 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.
Excellent; thanks for the link. I'd only just thought "Hey! Games
must do that".
So far I have a widget canvas where I can:
right-click -
pop-up menu -
create widget on layout at that location. -
grab the frame of the widget and move it around -
create more widgets
Only as soon as I drag a widget the scroll-bars of the Layout become
oddly disconnection.
So that is my next issue, then to look at the overlapping.
Also I can't yet resize the layout dynamically if the widget gets
dragged of the edge.
<https://sourceforge.net/u/whitemice/whitemicehg/ci/f731db465262a4d7751c69700ba3f39f04c28e96/tree/Scraps/Python/Gtk/WidgetCanvas.py>
> On Tue, Mar 6, 2012 at 9:20 AM, Adam Tauno Williams
> <awilliam at whitemice.org>wrote:
>> On Tue, 2012-03-06 at 09:05 -0700, asomers at 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
>> > <awilliam at 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?]
More information about the pygtk
mailing list