Skip to content

Commit

Permalink
updated code for wxPython 4.0 (Phoenix) and some modern MPL issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBarker-NOAA committed Feb 2, 2018
1 parent 51e0150 commit fe1828a
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 198 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
02-25-2016 Chris Barker <[email protected]>
* Release 2.2.0
* Assorted updated for wxPython >= 4.0
* Other updated for modern MPL (tested on '2.1.2')

02-25-2016 Chris Barker <[email protected]>
* re-structured to have simpler setup.py and stucture
* added setuptools to allow develop mode.
Expand Down
39 changes: 25 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ http://agni.phys.iit.edu/~kmcivor/wxmpl/

Ken has not maintained this for a while, and is no longer at IIT.

WxMpl - Painless matplolib embedding for wxPython
-------------------------------------------------
WxMpl - Painless matplotlib embedding for wxPython
--------------------------------------------------

The `wxmpl' module provides an matplotlib `FigureCanvas' with user-interaction
features like point-under-cursor and zooming in on a selected area.
Expand All @@ -24,51 +24,62 @@ subdirectory.
REQUIREMENTS
------------

* Python 2.5 or later
* Python 2.7 (would like to do a Py3 port, but not yet...)
http://www.python.org

* wxPython 2.6.3.2 or later
* wxPython 4.0 or later
http://www.wxpython.org

* matplotlib 0.98.1 or later
(It may work with earlier versions, but this is what it was tested on)

* matplotlib 2.1 or later
http://matplotlib.sourceforge.net

(Also may work for eariler versions, but >= 0.9.8 anyway)

PLATFORMS
---------

WxMpl has been tested under Debian GNU/Linux 5.0 "Lenny" [wxPython 2.6.3.2] and Mac OS 10.5.6 [wxPython 2.8.9.1].
WxMpl has been tested under Windows 10 and Mac OS 10.11 [wxPython 4.0.0].


INSTALLATION
------------

The Python Distutils system provides packaging, compilation, and installation
The Python setuptools and pip system provides packaging, compilation, and installation
for wxmpl.

To install, execute the following command as superuser:
# python setup.py install [OPTIONS]
To install, execute the following command as superuser::

$ python setup.py install [OPTIONS]

Or:

$ pip install ./

For more information about installation options, execute the following
command:
> python setup.py install --help

For information about other Distutils commands, execute the following command:
For information about other setuptools commands, execute the following command:
> python setup.py install --help-commands


AVAILABILITY
------------

There is no website for WxMpl yet, so your best bet is to bug Ken.

WxMpl's subversion repository is http://svn.csrri.iit.edu/mr-software/wxmpl/
Project curently being manged on gitHub here:

https://github.com/NOAA-ORR-ERD/wxmpl

AUTHOR
------

WxMpl was written by Ken McIvor <[email protected]>
WxMpl was written by: Ken McIvor <[email protected]>

Contirbutions from: Carlo Segre <[email protected]>

Currently maintained by: Chris Barker <[email protected]>


COPYRIGHT & LICENSE
Expand Down
18 changes: 10 additions & 8 deletions demos/picking_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class MyApp(wx.App):
def OnInit(self):
self.frame = panel = MyFrame(None, -1, 'Point Picker')
self.frame = MyFrame(None, -1, 'Point Picker')
self.frame.Show(True)
return True

Expand All @@ -31,12 +31,13 @@ def __init__(self, parent, id, title, **kwds):
self.selectionPoints = []
self.plotPanel = wxmpl.PlotPanel(self, -1)
self.regionButton = wx.ToggleButton(self, -1, 'Pick Region')
self.pointButton = wx.ToggleButton(self, -1, 'Pick Point')
self.pointButton = wx.ToggleButton(self, -1, 'Pick Point')

wx.EVT_TOGGLEBUTTON(self, self.regionButton.GetId(),
self._on_regionButton)
self.Bind(wx.EVT_TOGGLEBUTTON, self._on_regionButton, self.regionButton)

# self.Bind(wxmpl.EVT_POINT, self._on_point, self.plotPanel)
wxmpl.EVT_POINT(self, self.plotPanel.GetId(), self._on_point)

wxmpl.EVT_POINT(self, self.plotPanel.GetId(), self._on_point)
wxmpl.EVT_SELECTION(self, self.plotPanel.GetId(), self._on_selection)

self._layout()
Expand All @@ -46,12 +47,12 @@ def _layout(self):
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.Add((1, 1), 1, 0, 0)
btnSizer.Add(self.regionButton, 0, wx.RIGHT, 5)
btnSizer.Add(self.pointButton, 0)
btnSizer.Add(self.pointButton, 0)
btnSizer.Add((20, 1), 0, 0, 0)

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.plotPanel, 1, wx.EXPAND, 5)
sizer.Add(btnSizer, 0, wx.ALIGN_RIGHT|wx.ALL, 5)
sizer.Add(btnSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

self.SetSizer(sizer)
self.Fit()
Expand Down Expand Up @@ -116,10 +117,11 @@ def _on_selection(self, evt):
x1, y1 = evt.x1data, evt.y1data
x2, y2 = evt.x2data, evt.y2data

self.selectionPoints.append(((x1, y1), x2-x1, y2-y1))
self.selectionPoints.append(((x1, y1), x2 - x1, y2 - y1))
self._replot()

def _on_point(self, evt):
print "in _on_point", evt
if self.pointButton.GetValue():
self.pointButton.SetValue(False)
if evt.axes is not None:
Expand Down
Loading

0 comments on commit fe1828a

Please sign in to comment.