Werner F. Bruhin wrote:
>> I like to "append" rackUnits, i.e. not hardcode the startPos.
>>
>> But I can't find a method/variable in the canvas giving me the extend of
>> the existing objects - is there one or how else could I calculate what
>> the next free position to the right is?
>>    
> I found a solution, but is this fine or is there a cleaner one?
> 
>          bBox = self.canvas.BoundingBox[1]

yup -- that's it.

>          if bBox[0]>0:

Why the check for 0 here? Note that the bounding box is a bounding box 
object, which is a subclass of a numpy array, but also has other nifty 
methods -- see the code in floatcanvas.utilities

However, I'm not sure I'd do it this way -- the canvas keeps track of 
the bounding box so that it knows what/when to draw, and you can zoom 
the it, etc. There may be times when it is our of sync -- in which case, 
I think there is a flag something like Canvas.BoundBoxDirty (or 
something like that -- I"d have to look at the code) that should be set.

But I'd think that I wouldn't rely on the Canvas for this -- rather, you 
have you Rack objects, can't you use the coordinates of the existing 
racks directly? You might create a subclass of the Group object that 
adds some extra methods for querying this sort of thing.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to