Brian Hamlin wrote:
> looking at the samples, I am guessing the right direction is to add my
> Points to a PointGroup,
I'd use a PointSet Object -- it's be the fastest.
> and BIND then to a couple of events, like mouse
> over and mouse down.
yup.
> I'll use the Nearest or whatever to find the Point.
It has a FindClosestPoint() method.
The other option is to to create a separate Point Object for each point,
and Bind that to your callbacks. This being Python, you can add any data
you want to your Point object, so you can identify which one it is in
your callback. FloatCanvas events pass in a reference to the object
clicked on.
The difference between the two approaches is performance (and memory, I
suppose), vs. convenience. For less than maybe 1000 points, either will
do fine. Oh, and all the points in a PointSet object are the same size
and color, so if you need to differentiate the points, you'll need to
use Point.
You may or may not want to put them in a Group Object -- that would
allow you to do things like Hide() them with one call, and stuff like
that. I'd still bind the events separately though, why not let
FloatCanvas figure out which one got hit?
grep the Demos for "Point(", ", "pointSet(" and maybe "FindClosestPoint"
to see examples.
A note about tooltips:
You can't place a tooltip exactly where you want on all platforms -- I
can't remember which but at least one common platform insists on putting
the tooltip at the bottom of it's associated Window, which in this case
would be the floatcanvas, which probably isn't what you want. There are
ways to fake tooltips though. See the wxPython list for ideas.
I've cc'd this to the floatcanvas list -- please post further questions
there, you may get help from others, and I like to have these kinds of
questions archived:
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
-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