On Thu, May 15, 2014 at 3:12 AM, Farrukh <[email protected]> wrote:
> Thank you for help in adding shapes to *InForeground* in *LeftDown* and
> *InBackground* in *LeftUp*. I am experiencing another issue , I have
> already added bitmap using *AddScaledBitmap*, now *I am trying to* *fit
> bitmap on floatcanvas*, here is my code.
>
> w, h = self.GetSize()
>
> if w >= 790 and w <= 810: # size on startup
>
> self.canvas.Zoom(1.2)
>
> self.canvas.Draw()
>
> elif w >= 1020 and w <= 1040: # size on 1024 x 768
>
> self.canvas.Zoom(1.4)
>
> self.canvas.Draw()
>
> elif w >= 1270 and w<= 1300: # size on 1280 x 800
>
> self.canvas.Zoom(1.70)
>
> self.canvas.Draw()
> but it is zooming and i don't know how i can fit bitmap like adobe acrobat
> reader fit width of pages. i will be grateful for help.
>
YOu are tryin gtoo hard! the point of FloatCanvas is for it do do this
stuff for you.
Try:
self.canvas.ZoomToBB()
That will zoom and pan so that everything on the canvas is shown.
If you want more control, you can pass in the bounding box you want to zoom
to and/or adjust the margins (extra space around the bounding box)
def ZoomToBB(self, NewBB=None, DrawFlag=True, margin_adjust=0.95):
"""
Zooms the image to the bounding box given, or to the bounding
box of all the objects on the canvas, if none is given.
:param NewBB=None: the bounding box you want to zoom in to.
If None, it will be calcuated from all the
objects on the Canvas.
:type NewBB: floatcanvas.utilities.BBox.BBox object (or something
compatible).
:param DrawFlag=True: If True, will force a re-draw, regardless of
whether
anythign has changed on the Canvas
:param margin_adjust=0.95: amount to adjust the scale so the BB
will have a
bit of margin in the Canvas. 1.0 shoud
be a tight fit.
:type margin_adjust: float
"""
Do poke into the code to see what's there -- one of these days I'll fire up
Sphinx an make a proper doc...
-Chris
>
> Farrukh
>
>
> ------------------------------
> <http://www.avast.com/>
>
> This email is free from viruses and malware because avast!
> Antivirus<http://www.avast.com/>protection is active.
>
>
--
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://mailman.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas