[wxPython-users] Testing for points inside a polygon

Christopher Barker Chris.Barker at noaa.gov
Tue May 8 12:37:48 PDT 2007


Ed Leafe wrote:
>     Thanks - I got it working in Windows, but I'll tuck that away for 
> when (if!) they need to run this on OS X.

I know you're a supporter of cross platform solutions, I took some pains 
to solve this exact problem in FloatCanvas. You can find that code here:

http://morticia.cs.dal.ca/FloatCanvas/browser/trunk/floatcanvas/FloatCanvas.py

look for the GetHitTestColor method. There are two versions there: the 
pre 2.8 way and the 2.8 way.

Before 2.8, you could use dc.GetPixelPoint on all platforms, but the 
PixelData objects are new to 2.8, so I had to bifurcate.

The 2.8 code seems to work on all platforms (you do need to make sure 
you create 32 bit bitmaps)

-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

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list