Hi,

Yes, thanks this information helps. I am aware that when you create it, you
specify the dimensions of the rectangle, but still i wanted to learn whether
they are an attribute of the rectangle DrawObject; thus, the call R.WH would
give you the width and the height of the rectangle you specified when you
added it on the canvas. Thanks for the extra information on how to re-size
and re-shape a rect that is added on your canvas.

Cheers,

Can

Can Baran wrote:
> I would like to add a rectangle which should indicate the borders of a
> drawing area. I would like to be able to get the width and the height of
> the rectangle that is added on the canvas. Is there any function which
> gets you the dimensions of the rectangle you add onto the canvas?

You have to give it a width and height to create it, so don't you
already know it?

But anyway, they are an attribute of the Rectangle DrawObject:

R = Canvas.AddRectangle( (0,0), (10,20))

width, height = R.WH

Rectangle.WH is a (2,) sized numpy array. That means you can do math on
it, like:

R.WH *= 2

to make it larger. You should have it re-calculate the bounding box
after doing this though:

R.CalcBoundingBox()

You can also just assign the rectangle a new shape:

R.SetShape( (x, y), (width, height) )

or just move it:

R.SetPoint((x, y))

(I don't know why there isn't a SetSize() or something like that, but I
guess I never needed it)

Does that help?


-Chris

--
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to