Ørjan Pettersen wrote:
> I have a bitmap with a size of 50x50. But when I add it to a FloatCanvas
> it turns up very very small. How do I make them appear in normal
> size(50x50)?
The MovingBitmap is derived from the ScaledBitmap, which is designed to
change its size as you zoom in and out. I guess I should have called it
MovingScaledBitmap.
If you want the Bitmap to stay the same size regardless of zoom, then
you want to make new MovingBitmap class, derived from FloatCanvas.Bitmap
instead:
class MovingStaticBitmap(FC.Bitmap,
MovingObjectMixin,
ConnectorObjectMixin):
"""
ScaledBitmap Object that can be moved
"""
## All we need to do is is inherit from:
## ScaledBitmap, MovingObjectMixin and ConnectorObjectMixin
pass
should do it -- untested.
> btm = MovingBitmap(wx.Bitmap('images/out.png'), (0,0), 1,
> Position='cc')
in this case, you've set the hieght of the bitmap to 1 is world
coordinates -- make that bigger, and the bitmap will be bigger.
In the future, it's helpful to post a complete (but small) working
application if can -- that was we can quickly test stuff for you:
http://wiki.wxpython.org/MakingSampleApps
>> I guess focus means highlighting the object somehow (e.g. drawing
>> transparent rectangle over it or hollow rectangle box around it).
>>
> Exactly. But if this is not native, i guess it won't be hard to create
> it based on left click event.
correct. It's not native. I can quickly think of three ways to
accomplish it:
1) create your own DrawObject that has a "selected" attribute, and have
it drawn differently if it is selected
2) add another object to the Canvas on top of the selected object hat
draws something to make it look selected.
3) create a group object, and put your object in it, and another one on
top that makes it look selected.
Maybe this should be built-in -- I"m trying to think of a way to add it
to the base DrawObject, but I'm not sure how to intercept the _Draw
method...
-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