Hi David,
A couple comments:
David Poundall wrote:
> I am selecting a group of objects and doing a BB.Merge to get an all
> encompassing
>
> Bounding Box. I then paint the containing bounding box to canvas using …
> dc = wx.ClientDC(Canvas)
> dc.SetPen(wx.Pen('WHITE', 2, wx.DOT))
> dc.SetBrush(wx.TRANSPARENT_BRUSH)
> dc.SetLogicalFunction(wx.XOR)
> OutlinePoints = N.array( ( (BB[0,0], BB[0,1]),
> (BB[0,0], BB[1,1]),
> (BB[1,0], BB[1,1]),
> (BB[1,0], BB[0,1]) ))
A BB object is a subclass of a Numpyarray, so you should be able to just do:
OutlinePoints = BB.reshape((4, 2))
> dc.DrawPolygon(Canvas.WorldToPixel(OutlinePoints))
> Selecting another item to the group gives a new BB.Merge result. To
> draw the new
>
> Polygon to the Canvas I am trying to do a canvas refresh prior to using
> the above code to display the new selection polygon.
Interestingly, I've never tried that, even though it is the obvious
thing to do!
> The problem is that if a Canvas.Refresh() is placed before the above
> code or I
>
> Completely redraw the canvas thereby clearing the old BB.merge polygon,
> the new
>
> Polygon does not draw.
>
> Is there a timing or buffer issue in play here ??
I think there is a timing issue here. I don't totally understand this,
but I think that Refresh() may not actually do a refresh NOW, but
rather, put the request on the event stack. since you're in the middle
of en event, the Refresh() may get run AFTER the code your
re in is done.
Possible solutions:
1) Use the trick that is used in most of the other code -- keep a copy
of the coords of the old box around, and draw it again to erase it
(that's what wx.XOR does)
2) try calling wx.GetApp().Yield(onlyIfNeeded=True), after your
Refresh(), that may clear the event stack.
3) Use a wx.Overlay -- Robin just posted an example of this on the
wxPython-users list. It's pretty cool.
-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://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas