(I am new to wxWidgets / wxPython and new to GUI implementation; experienced
programmer otherwise)

I am looking for advice / direction on implementing a widget that can do
area selection on a plot. Any pointers from experienced users would be much
appreciated.

What needs to be done is:

(1) Implement a two dimensional plot.
(2) Implement a resizeable square that can be moved around to select an area
on the plot.
(3) Report the plot points that fall within that area.

I realize that given the coordinates of the square and a sorted list of plot
points, the contained plot points are easy to compute. I am just not sure of
the widgets / graphics techniques to use to implement the plot itself and
the resizeable square.

Hi. I don't know if this can be done with the pyPlot module (see the wxPython
demo) but I believe all 3 of these can be done with the powerful 2-d plotting
library matplotlib. The matplotlib plot can then be embedded in a wxPython
app if you want. I'm not sure how to do (2) and (3), but interactive
use of the
plots is one of the features of matplotib. In fact the standard
matplotlib toolbar
has a zoom rectangle tool that is getting close to what you want (and in some
examples the coordinates are shown in the toolbar)

There is a matplotlib list that can probably help you out.

The Chaco library may also be able to do this, but I have no experience with
that.

Che

···

On Sun, May 10, 2009 at 6:04 PM, AAGEE <sanjay@ziffusion.com> wrote:

Hi

(I am new to wxWidgets / wxPython and new to GUI implementation; experienced
programmer otherwise)

I am looking for advice / direction on implementing a widget that can do
area selection on a plot. Any pointers from experienced users would be much
appreciated.

What needs to be done is:

(1) Implement a two dimensional plot.
(2) Implement a resizeable square that can be moved around to select an area
on the plot.
(3) Report the plot points that fall within that area.

I realize that given the coordinates of the square and a sorted list of plot
points, the contained plot points are easy to compute. I am just not sure of
the widgets / graphics techniques to use to implement the plot itself and
the resizeable square.

(1) Implement a two dimensional plot.
(2) Implement a resizeable square that can be moved around to select an area
on the plot.
(3) Report the plot points that fall within that area.

Hi. I don't know if this can be done with the pyPlot module (see the wxPython
demo) but I believe all 3 of these can be done with the powerful 2-d plotting
library matplotlib.

yup -- good choice -- you might want to use wxMPL to make it a bit easier to embed the plot in wx.

The Chaco library may also be able to do this,

It sure can too.

If you want to keep it more lightweight, and use wx.lib.pyPlot, you might want to use the enclosed code for the selection rectangle.

On Sun, May 10, 2009 at 6:04 PM, AAGEE <sanjay@ziffusion.com> wrote:

--
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