wxmplot 0.9.14__tar.gz → 0.9.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. {wxmplot-0.9.14 → wxmplot-0.9.20}/MANIFEST.in +1 -1
  2. {wxmplot-0.9.14 → wxmplot-0.9.20}/PKG-INFO +2 -1
  3. {wxmplot-0.9.14 → wxmplot-0.9.20}/README.txt +2 -2
  4. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/_templates/indexsidebar.html +1 -5
  5. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/conf.py +3 -3
  6. wxmplot-0.9.20/doc/images/basic_screenshot.png +0 -0
  7. wxmplot-0.9.20/doc/images/configuration_frame.png +0 -0
  8. wxmplot-0.9.20/doc/index.rst +39 -0
  9. wxmplot-0.9.20/doc/installation.rst +69 -0
  10. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/plotpanel.rst +6 -8
  11. wxmplot-0.9.20/examples/__pycache__/tifffile.cpython-35.pyc +0 -0
  12. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/contour.py +0 -4
  13. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/demo.py +12 -11
  14. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/floatcontrol.py +23 -29
  15. wxmplot-0.9.20/examples/floatcontrol.pyc +0 -0
  16. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/image.py +1 -3
  17. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/leftright.py +0 -3
  18. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/multiplot.py +2 -1
  19. wxmplot-0.9.20/examples/pilatus_display.py +14 -0
  20. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/rgb_image.py +4 -4
  21. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/scatterplot.py +2 -9
  22. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/simple.py +1 -7
  23. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/stripchart.py +6 -9
  24. wxmplot-0.9.20/examples/tiff_display.py +12 -0
  25. wxmplot-0.9.20/examples/tifffile.py +2815 -0
  26. wxmplot-0.9.20/examples/tifffile.pyc +0 -0
  27. wxmplot-0.9.20/examples/update_line.py +40 -0
  28. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/__init__.py +7 -14
  29. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/baseframe.py +48 -37
  30. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/basepanel.py +35 -26
  31. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/colors.py +12 -6
  32. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/config.py +32 -12
  33. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/imageconf.py +13 -14
  34. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/imageframe.py +216 -164
  35. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/imagepanel.py +30 -22
  36. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/multiframe.py +2 -3
  37. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/plotconfigframe.py +189 -80
  38. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/plotframe.py +5 -7
  39. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/plotpanel.py +285 -49
  40. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/utils.py +12 -9
  41. {wxmplot-0.9.14 → wxmplot-0.9.20}/setup.py +1 -1
  42. wxmplot-0.9.14/doc/images/basic_screenshot.png +0 -0
  43. wxmplot-0.9.14/doc/images/configuration_frame.png +0 -0
  44. wxmplot-0.9.14/doc/index.rst +0 -39
  45. wxmplot-0.9.14/doc/installation.rst +0 -82
  46. wxmplot-0.9.14/doc/wxmplot.pdf +0 -0
  47. wxmplot-0.9.14/examples/contour_A.py +0 -24
  48. wxmplot-0.9.14/examples/floatcontrol.pyc +0 -0
  49. wxmplot-0.9.14/examples/p1.py +0 -50
  50. wxmplot-0.9.14/examples/pilatus_display.py +0 -22
  51. wxmplot-0.9.14/examples/test.tiff +0 -1
  52. wxmplot-0.9.14/examples/tiff_display.py +0 -18
  53. {wxmplot-0.9.14 → wxmplot-0.9.20}/ChangeLog +0 -0
  54. {wxmplot-0.9.14 → wxmplot-0.9.20}/LICENSE.txt +0 -0
  55. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/Makefile +0 -0
  56. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/_static/empty +0 -0
  57. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/imagepanel.rst +0 -0
  58. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/contour.png +0 -0
  59. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/image_3color.png +0 -0
  60. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/image_3color_white.png +0 -0
  61. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/imagedisplay.png +0 -0
  62. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/multiplot.png +0 -0
  63. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/scatterplot.png +0 -0
  64. {wxmplot-0.9.14 → wxmplot-0.9.20}/doc/images/two_axes.png +0 -0
  65. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/Pilatus.tiff +0 -0
  66. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/basic_screenshot.py +0 -0
  67. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/dislin_comp.py +0 -0
  68. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/errorbar.py +0 -0
  69. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/plot_fromdatafile.py +0 -0
  70. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/plotapp.py +0 -0
  71. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/time.dat +0 -0
  72. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/timedata.py +0 -0
  73. {wxmplot-0.9.14 → wxmplot-0.9.20}/examples/xafs.dat +0 -0
  74. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/contourdialog.py +0 -0
  75. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/ordereddict.py +0 -0
  76. {wxmplot-0.9.14 → wxmplot-0.9.20}/lib/plotapp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  include README.txt LICENSE.txt ChangeLog MANIFEST.in
2
2
  recursive-include lib *.py
3
3
  recursive-include examples *
4
- recursive-include examples test.tif*
4
+ recursive-exclude examples/*.tiff
5
5
  recursive-include doc *
6
6
  recursive-exclude doc/_build *
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: wxmplot
3
- Version: 0.9.14
3
+ Version: 0.9.20
4
4
  Summary: A library for plotting in wxPython using matplotlib
5
5
  Home-page: http://newville.github.io/wxmplot/
6
6
  Author: Matthew Newville
@@ -23,3 +23,4 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
23
23
  Requires: wx
24
24
  Requires: numpy
25
25
  Requires: matplotlib
26
+ Requires: six
@@ -52,9 +52,9 @@ user can zoom in, rotate, or flip the image, and adjust the smoothing of
52
52
  the image and adjust the color table and intensity scale.
53
53
 
54
54
  Programmatically, one can make the same adjustments to an ImagePanel by
55
- changing its configuaration attributes and runnign the redraw() method.
55
+ changing its configuaration attributes and running the redraw() method.
56
56
 
57
57
  =====
58
58
 
59
- last update: 2011-Nov-20 Matt Newville <newville@cars.uchicago.edu>
59
+ last update: 2016-Oct-24 Matt Newville <newville@cars.uchicago.edu>
60
60
 
@@ -2,16 +2,12 @@
2
2
  <p>Current version: <b>{{ release }}</b></p>
3
3
  <p>Downloads:
4
4
  <ul>
5
- <li>&nbsp; &nbsp; <a href="http://cars.uchicago.edu/software/python/wxmplot/src/">cars.uchicago.edu</a>
6
5
  <li>&nbsp; &nbsp; <a href="http://pypi.python.org/pypi/wxmplot/">PyPI (Python.org)</a> <p>
7
- try <tt>easy_install -U wxmplot</tt>
6
+ try <tt>pip install wxmplot</tt>
8
7
  </ul>
9
8
  <p>
10
9
 
11
10
  Development version: <br> &nbsp; &nbsp; <a href="https://github.com/newville/wxmplot/">github.com</a> <br>
12
11
 
13
- <h3>Documentation</h3>
14
-
15
- <a href="wxmplot.pdf"> PDF Format</a>
16
12
  <hr>
17
13
  <p>
@@ -37,7 +37,7 @@ master_doc = 'index'
37
37
 
38
38
  # General information about the project.
39
39
  project = u'wxmplot'
40
- copyright = u'2011, Matthew Newville, The University of Chicago'
40
+ copyright = u'2015, Matthew Newville, The University of Chicago'
41
41
 
42
42
  # The version info for the project you're documenting, acts as replacement for
43
43
  # |version| and |release|, also used in various other places throughout the
@@ -110,10 +110,10 @@ html_theme = 'sphinxdoc'
110
110
  # The name for this set of Sphinx documents. If None, it defaults to
111
111
  # "<project> v<release> documentation".
112
112
  #html_title = None
113
- html_title = 'WXMPlot: 2d plotting widgets for wxPython, using matplotlib'
113
+ html_title = 'WXMPlot: Plotting widgets for wxPython with matplotlib'
114
114
 
115
115
  # A shorter title for the navigation bar. Default is the same as html_title.
116
- html_short_title = 'WXMPlot: 2d plotting widgets for wxPython, using matplotlib'
116
+ html_short_title = 'WXMPlot: Plotting widgets for wxPython with matplotlib'
117
117
 
118
118
  # The name of an image file (relative to this directory) to place at the top
119
119
  # of the sidebar.
@@ -0,0 +1,39 @@
1
+
2
+ .. wxmplot documentation master file
3
+
4
+ WXMPLOT: Plotting widgets for wxPython with matplotlib
5
+ ==================================================================
6
+
7
+ .. _wxPython: http://www.wxpython.org/
8
+ .. _matplotlib: http://matplotlib.sourceforge.net/
9
+
10
+ The wxmplot python package provides easy-to-use, richly featured plotting
11
+ widgets for `wxPython`_ built on top of the wonderful `matplotlib`_
12
+ library. While matplotlib provides excellent general purpose plotting
13
+ functionality, and supports a variety of GUI and non-GUI backends, it does
14
+ not have a very tight integration with any particular GUI toolkit.
15
+ Similarly, while wxPython has some plotting functionality, it has nothing
16
+ as good as matplotlib. The wxmplot package attempts to bridge this gap,
17
+ providing wx.Panels for basic 2D line plots and image display that are
18
+ richly featured and provide end-users with interactivity (zooming, reading
19
+ positions, rotating images) and customization (line types, labels, marker
20
+ type, colors, and color tables) of the graphics without having to know
21
+ matplotlib. Wxmplot does not expose all of matplotlib's capabilities, but
22
+ does provide 2D plotting and image display Panels and Frames can be used
23
+ simply in wxPython applications to handle many use cases.
24
+
25
+ The wxmplot package is aimed at programmers who want to include high
26
+ quality scientific graphics in their applications that can be manipulated
27
+ by the end-user. If you're a python programmer who is comfortable writing
28
+ complex pylab scripts or plotting interactively from IPython, this package
29
+ may seem too limiting for your needs. On the other hand, wxmplot provides
30
+ better defaults and better customizations than matplotlib's Navigation
31
+ toolbars.
32
+
33
+
34
+ .. toctree::
35
+ :maxdepth: 2
36
+
37
+ installation
38
+ plotpanel
39
+ imagepanel
@@ -0,0 +1,69 @@
1
+ ====================================
2
+ Downloading and Installation
3
+ ====================================
4
+
5
+ Prerequisites
6
+ ~~~~~~~~~~~~~~~
7
+
8
+ The wxmplot package requires wxpython, matplotlib, numpy, and six.
9
+
10
+ For wxPython Classic, wxmplot works well with Python 2.7, but not Python 3.
11
+ Since matplotlib 1.5 introduced support for wxPython Phoenix, wxmplot also
12
+ works with matplotlib 1.5, wxPython Phoenix 3.0.3, and with both Python 2.7
13
+ and Python 3.5. As wxPython Phoenix is still in development (available at
14
+ http://wxpython.org/Phoenix/snapshot-builds/), support for it should be
15
+ viewed as provisional. Testing with Phoenix and with Python 3.5 has been
16
+ modest, but all wxmplot functionality appears to work.
17
+
18
+ Downloads
19
+ ~~~~~~~~~~~~~
20
+
21
+ .. _github: http://github.com/newwville/wxmplot
22
+ .. _PyPI: http://pypi.python.org/pypi/wxmplot
23
+
24
+ The latest version is available from `PyPI`_ or `github`_, and the package
25
+ can be installed with::
26
+
27
+ pip install wxmplot
28
+
29
+ Development Version
30
+ ~~~~~~~~~~~~~~~~~~~~~~~~
31
+
32
+ To get the latest development version, use::
33
+
34
+ git clone http://github.com/newville/wxmplot.git
35
+
36
+ Installation from Source
37
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
+
39
+ wxmplot is a pure python module, so installation on all platforms can use the source kit::
40
+
41
+ tar xvzf wxmplot-0.9.XX.tar.gz
42
+ cd wxmplot-0.9.XX/
43
+ python setup.py install
44
+
45
+ You can also install with ``pip install wxmplot``, or for Anaconda Python,
46
+ using ``conda install -c newville wxmplot``
47
+
48
+ License
49
+ ~~~~~~~~~~~~~
50
+
51
+ The wxmplot code is distribution under the following license:
52
+
53
+ Copyright (c) 2015 Matthew Newville, The University of Chicago
54
+
55
+ Permission to use and redistribute the source code or binary forms of this
56
+ software and its documentation, with or without modification is hereby
57
+ granted provided that the above notice of copyright, these terms of use,
58
+ and the disclaimer of warranty below appear in the source code and
59
+ documentation, and that none of the names of The University of Chicago or
60
+ the authors appear in advertising or endorsement of works derived from this
61
+ software without specific prior written permission from all parties.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
66
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
68
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
69
+ DEALINGS IN THIS SOFTWARE.
@@ -10,7 +10,7 @@ including line plots and scatter plots. It has both an easy-to-use
10
10
  programming interface, and a rich graphical user interface for
11
11
  manipulating the plot after it has been drawn. The :class:`PlotPanel`
12
12
  class is derived from a :class:`wx.Panel` and so that it can be
13
- included anywhere in a wx Windo object that a normal :class:`wx.Panel`
13
+ included anywhere in a wx Window object that a normal :class:`wx.Panel`
14
14
  can be put. In addition to drawing a plot, a :class:`PlotPanel`
15
15
  provides the following capabilities to the end-user:
16
16
 
@@ -44,15 +44,13 @@ many additional methods to interact with the plots.
44
44
  :type size: wx.Size or tuple of 2 integers.
45
45
  :param dpi: dots per inch for figure (150).
46
46
  :type dpi: integer
47
- :param axissize: size for maplotlib Axis ([0.16, 0.16, 0.72, 0.72])
48
- :type axissize: list of 4 floats
49
47
  :param axisbg: background colour for Axis ('#FEFEFE').
50
48
  :type axisbg: valid colour name
51
49
  :param fontsize: font size for wxFont for labels and ticks (9).
52
50
  :type fontsize: integer
53
- :param output_tilte: string to use for output plots ('plot').
51
+ :param output_title: string to use for output plots ('plot').
54
52
  :param messenger: function to use for writing output messages (``None``).
55
- :type messenger: callable or ``None``
53
+ :type messenger: callable or ``None``
56
54
  :param trace_color_callback: function to call when a color changes (``None``).
57
55
  :type trace_color_callback: callable or ``None``
58
56
  :param show_config_popup: whether to enable a popup-menu on right-click.
@@ -84,7 +82,8 @@ many additional methods to interact with the plots.
84
82
 
85
83
  .. method:: oplot(x, y, **kws)
86
84
 
87
- Draw a plot of the numpy arrays *x* and *y*, overwriting any existing plot.
85
+ Draw a plot of the numpy arrays *x* and *y*, overplotting any existing
86
+ plot, so that both traces are visible.
88
87
 
89
88
  The :meth:`oplot` method has many optional parameters, as listed in
90
89
  :ref:`Table of Plot Arguments <plotopt_table>`
@@ -213,7 +212,7 @@ same meaning, as indicated by the right-most column.
213
212
  'lower right', 'lower left', 'upper center', 'lower center', or 'center').
214
213
 
215
214
  10. The *use_dates* option is not very rich, and simply turns x-values that are Unix timestamps into x
216
- labels showing the dates.
215
+ labels showing the dates.
217
216
 
218
217
  All of these values, and a few more settings controlling whether and how to display a plot legend can be
219
218
  configured interactively (see Plot Configuration).
@@ -450,4 +449,3 @@ the source distribution kit. The *demo.py* script there will show several
450
449
  dynamic plot, updating the plot as fast as it can - typically 10 to 30
451
450
  times per second, depending on your machine. The *stripchart.py* example
452
451
  script also shows a dynamic, time-based plot.
453
-
@@ -1,8 +1,4 @@
1
1
  import sys
2
- if not hasattr(sys, 'frozen'):
3
- import wxversion
4
- wxversion.ensureMinimal('2.8')
5
-
6
2
  import wx
7
3
  from numpy import exp, random, arange, outer
8
4
  from wxmplot import ImageFrame
@@ -1,9 +1,11 @@
1
1
  import sys
2
- if not hasattr(sys, 'frozen'):
3
- import wxversion
4
- wxversion.ensureMinimal('2.8')
5
-
6
2
  import wx
3
+ is_wxPhoenix = 'phoenix' in wx.PlatformInfo
4
+ if is_wxPhoenix:
5
+ PyDeadObjectError = RuntimeError
6
+ else:
7
+ from wx._core import PyDeadObjectError
8
+
7
9
  import time, os, sys
8
10
 
9
11
  from numpy import arange, sin, cos, exp, pi, linspace, ones, random
@@ -22,17 +24,16 @@ class TestFrame(wx.Frame):
22
24
  self.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL,wx.BOLD,False))
23
25
  menu = wx.Menu()
24
26
  ID_EXIT = wx.NewId()
25
- ID_TIMER = wx.NewId()
26
27
 
27
- menu.Append(ID_EXIT, "E&xit", "Terminate the program")
28
+ menu_exit = menu.Append(ID_EXIT, "E&xit", "Terminate the program")
28
29
 
29
30
  menuBar = wx.MenuBar()
30
31
  menuBar.Append(menu, "&File");
31
32
  self.SetMenuBar(menuBar)
32
33
 
33
- wx.EVT_MENU(self, ID_EXIT, self.OnExit)
34
+ self.Bind(wx.EVT_MENU, self.OnExit, menu_exit)
34
35
 
35
- self.Bind(wx.EVT_CLOSE,self.OnExit) # CloseEvent)
36
+ self.Bind(wx.EVT_CLOSE, self.OnExit) # CloseEvent)
36
37
 
37
38
  self.plotframe = None
38
39
 
@@ -79,8 +80,8 @@ class TestFrame(wx.Frame):
79
80
  self.SetSizer(framesizer)
80
81
  framesizer.Fit(self)
81
82
 
82
- wx.EVT_TIMER(self, ID_TIMER, self.onTimer)
83
- self.timer = wx.Timer(self, ID_TIMER)
83
+ self.Bind(wx.EVT_TIMER, self.onTimer)
84
+ self.timer = wx.Timer(self)
84
85
  self.Refresh()
85
86
 
86
87
  def create_data(self):
@@ -105,7 +106,7 @@ class TestFrame(wx.Frame):
105
106
  self.has_plot = False
106
107
  try:
107
108
  self.plotframe.Show()
108
- except wx.PyDeadObjectError:
109
+ except PyDeadObjectError:
109
110
  self.plotframe = PlotFrame(self)
110
111
  self.plotframe.Show()
111
112
 
@@ -1,18 +1,13 @@
1
1
  #!/usr/bin/env python
2
- #
2
+ #
3
3
  """
4
4
  This is a collection of general purpose utility functions and classes,
5
5
  especially useful for wx functionality
6
6
  """
7
7
  import sys
8
- if not hasattr(sys, 'frozen'):
9
- import wxversion
10
- wxversion.ensureMinimal('2.8')
11
-
12
8
  import wx
13
9
  import wx.lib.masked as masked
14
10
 
15
- import fpformat
16
11
  import numpy
17
12
 
18
13
 
@@ -66,12 +61,12 @@ class FloatCtrl(wx.TextCtrl):
66
61
  a wx.TextCtrl that allows only numerical input, can take a precision argument
67
62
  and optional upper / lower bounds
68
63
  Options:
69
-
64
+
70
65
  """
71
- def __init__(self, parent, value='', minval=None, maxval=None,
66
+ def __init__(self, parent, value='', minval=None, maxval=None,
72
67
  precision=3, bell_on_invalid = True,
73
68
  action=None, action_kw=None, **kws):
74
-
69
+
75
70
  self.__digits = '0123456789.-'
76
71
  self.__prec = precision
77
72
  if precision is None:
@@ -84,13 +79,13 @@ class FloatCtrl(wx.TextCtrl):
84
79
  self.__bound_val = None
85
80
  self.__mark = None
86
81
  self.__action = None
87
-
82
+
88
83
  self.fgcol_valid = "Black"
89
84
  self.bgcol_valid = "White"
90
85
  self.fgcol_invalid = "Red"
91
86
  self.bgcol_invalid = (254, 254, 80)
92
87
  self.bell_on_invalid = bell_on_invalid
93
-
88
+
94
89
  # set up action
95
90
  if action_kw is None:
96
91
  action_kw = {}
@@ -100,12 +95,12 @@ class FloatCtrl(wx.TextCtrl):
100
95
  if 'style' in kws:
101
96
  this_sty = this_sty | kws['style']
102
97
  kws['style'] = this_sty
103
-
98
+
104
99
  wx.TextCtrl.__init__(self, parent, wx.ID_ANY, **kws)
105
100
 
106
101
  self.__CheckValid(self.__val)
107
102
  self.SetValue(self.__val)
108
-
103
+
109
104
  self.Bind(wx.EVT_CHAR, self.OnChar)
110
105
  self.Bind(wx.EVT_TEXT, self.OnText)
111
106
 
@@ -116,13 +111,13 @@ class FloatCtrl(wx.TextCtrl):
116
111
  def SetAction(self, action, **kws):
117
112
  "set callback action"
118
113
  if hasattr(action,'__call__'):
119
- self.__action = Closure(action, **kws)
120
-
114
+ self.__action = Closure(action, **kws)
115
+
121
116
  def SetPrecision(self, prec=0):
122
117
  "set precision"
123
118
  self.__prec = prec
124
119
  self.format = '%%.%if' % prec
125
-
120
+
126
121
  def __GetMark(self):
127
122
  " keep track of cursor position within text"
128
123
  try:
@@ -152,17 +147,17 @@ class FloatCtrl(wx.TextCtrl):
152
147
  wx.Bell()
153
148
 
154
149
  self.__SetMark()
155
-
150
+
156
151
  def OnKillFocus(self, event):
157
152
  "focus lost"
158
153
  self.__GetMark()
159
154
  event.Skip()
160
-
155
+
161
156
  def OnSetFocus(self, event):
162
- "focus gained - resume editing from last mark point"
157
+ "focus gained - resume editing from last mark point"
163
158
  self.__SetMark()
164
159
  event.Skip()
165
-
160
+
166
161
  def OnChar(self, event):
167
162
  """ on Character event"""
168
163
  key = event.GetKeyCode()
@@ -181,10 +176,10 @@ class FloatCtrl(wx.TextCtrl):
181
176
  if (key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255):
182
177
  event.Skip()
183
178
  return
184
-
179
+
185
180
  # 3. check for multiple '.' and out of place '-' signs and ignore these
186
181
  # note that chr(key) will now work due to return at #2
187
-
182
+
188
183
  has_minus = '-' in entry
189
184
  ckey = chr(key)
190
185
  if ((ckey == '.' and (self.__prec == 0 or '.' in entry) ) or
@@ -194,8 +189,8 @@ class FloatCtrl(wx.TextCtrl):
194
189
  # 4. allow digits, but not other characters
195
190
  if chr(key) in self.__digits:
196
191
  event.Skip()
197
-
198
-
192
+
193
+
199
194
  def OnText(self, event=None):
200
195
  "text event"
201
196
  try:
@@ -207,7 +202,8 @@ class FloatCtrl(wx.TextCtrl):
207
202
 
208
203
  def GetValue(self):
209
204
  if self.__prec > 0:
210
- return set_float(fpformat.fix(self.__val, self.__prec))
205
+ fmt = "{{:.{:d}f}}".format(self.__prec)
206
+ return set_float(fmt.format(self.__val))
211
207
  else:
212
208
  return int(self.__val)
213
209
 
@@ -224,9 +220,9 @@ class FloatCtrl(wx.TextCtrl):
224
220
  self.__min = set_float(val)
225
221
 
226
222
  def SetMax(self, val):
227
- "set max value"
223
+ "set max value"
228
224
  self.__max = set_float(val)
229
-
225
+
230
226
  def __CheckValid(self, value):
231
227
  "check for validity of value"
232
228
  val = self.__val
@@ -249,5 +245,3 @@ class FloatCtrl(wx.TextCtrl):
249
245
  self.SetForegroundColour(fgcol)
250
246
  self.SetBackgroundColour(bgcol)
251
247
  self.Refresh()
252
-
253
-
Binary file
@@ -1,9 +1,7 @@
1
1
  import sys
2
- if not hasattr(sys, 'frozen'):
3
- import wxversion
4
- wxversion.ensureMinimal('2.8')
5
2
 
6
3
  import wx
4
+
7
5
  from numpy import exp, random, arange, outer
8
6
  from wxmplot import ImageFrame
9
7
 
@@ -3,9 +3,6 @@
3
3
  # example plot with left and right axes with different scales
4
4
 
5
5
  import sys
6
- if not hasattr(sys, 'frozen'):
7
- import wxversion
8
- wxversion.ensureMinimal('2.8')
9
6
 
10
7
  import wx
11
8
  import numpy as np
@@ -14,6 +14,8 @@ y4 = numpy.cos(2*x)*numpy.exp(-x/10.)
14
14
  app = wx.App()
15
15
 
16
16
  pframe = wxmplot.MultiPlotFrame(rows=2,cols=3,panelsize=(2.5,1.75))
17
+
18
+
17
19
  pframe.plot(x,y1,panel=(0,0))
18
20
  pframe.plot(x,y2,panel=(0,1))
19
21
  pframe.plot(x,y3,panel=(1,1))
@@ -26,4 +28,3 @@ pframe.Show()
26
28
  pframe.Raise()
27
29
 
28
30
  app.MainLoop()
29
-
@@ -0,0 +1,14 @@
1
+ #
2
+ # read Pilatus image into numpy array
3
+ import sys
4
+ import wx
5
+ from tifffile import imread
6
+ from wxmplot import ImageFrame
7
+
8
+ dat = imread('Pilatus.tiff')
9
+
10
+ app = wx.App()
11
+ frame = ImageFrame()
12
+ frame.display(dat)
13
+ frame.Show()
14
+ app.MainLoop()
@@ -17,13 +17,13 @@ if __name__ == '__main__':
17
17
  y = arange(ny)
18
18
  ox = x / 100.0
19
19
  oy = -1 + y / 200.0
20
- red = 0.3 * random.random(size=nx*ny).reshape(ny, nx)
20
+ red = 2. * random.random(size=nx*ny).reshape(ny, nx)
21
21
  red = red + 0.25 + (6.0*gauss2d(x, y, 90, 76, 5, 6) +
22
22
  3.0*gauss2d(x, y, 160, 190, 70, 33) +
23
23
  2.0*gauss2d(x, y, 180, 100, 12, 6))
24
- green = 0.1 * random.random(size=nx*ny).reshape(ny, nx)
25
- green = green + (1.0*gauss2d(x, y, 175, 98, 3, 7) +
26
- 1.2*gauss2d(x, y, 270, 230, 78, 63))
24
+ green = 0.3 * random.random(size=nx*ny).reshape(ny, nx)
25
+ green = green + 0.11 + (1.0*gauss2d(x, y, 175, 98, 3, 7) +
26
+ 1.2*gauss2d(x, y, 270, 230, 78, 63))
27
27
 
28
28
  blue = 0.6 * random.random(size=nx*ny).reshape(ny, nx)
29
29
  blue = blue + (2.9*gauss2d(x, y, 240, 265, 78, 23) +
@@ -3,19 +3,14 @@
3
3
  # scatterplot example, with lassoing and
4
4
  # a user-level lasso-callback
5
5
  import sys
6
- if not hasattr(sys, 'frozen'):
7
- import wxversion
8
- wxversion.ensureMinimal('2.8')
9
-
10
- import wxmplot
11
-
12
6
  import wx
7
+ import wxmplot
13
8
  import numpy
14
9
 
15
10
  x = numpy.arange(100)/20.0 + numpy.random.random(size=100)
16
11
  y = numpy.random.random(size=len(x))
17
12
  def onlasso(data=None, selected=None, mask=None):
18
- print ':: lasso ', selected
13
+ print( ':: lasso ', selected)
19
14
 
20
15
  app = wx.App()
21
16
 
@@ -28,5 +23,3 @@ pframe.write_message('WXMPlot PlotFrame example: Try Help->Quick Reference')
28
23
  pframe.Show()
29
24
  #
30
25
  app.MainLoop()
31
-
32
-
@@ -1,13 +1,7 @@
1
1
  #!/usr/bin/python
2
2
  #
3
- # simple example of MPlot
3
+ # simple example of wxMPlot
4
4
  import sys
5
- if not hasattr(sys, 'frozen'):
6
- try:
7
- import wxversion
8
- wxversion.ensureMinimal('2.8')
9
- except:
10
- pass
11
5
  import wx
12
6
  import numpy
13
7
  import wxmplot
@@ -2,10 +2,6 @@
2
2
  import time
3
3
  import numpy as np
4
4
  import sys
5
- if not hasattr(sys, 'frozen'):
6
- import wxversion
7
- wxversion.ensureMinimal('2.8')
8
-
9
5
  import wx
10
6
  from wx.lib import masked
11
7
  from floatcontrol import FloatCtrl
@@ -34,16 +30,17 @@ class StripChartFrame(wx.Frame):
34
30
  ID_EXIT = wx.NewId()
35
31
  ID_TIMER = wx.NewId()
36
32
 
37
- menu.Append(ID_EXIT, "E&xit", "Terminate the program")
33
+ menu_exit = menu.Append(ID_EXIT, "E&xit",
34
+ "Terminate the program")
38
35
 
39
36
  menuBar = wx.MenuBar()
40
37
  menuBar.Append(menu, "&File");
41
38
  self.SetMenuBar(menuBar)
42
39
 
43
- wx.EVT_MENU(self, ID_EXIT, self.OnExit)
40
+ self.Bind(wx.EVT_MENU, self.OnExit, menu_exit)
44
41
  self.Bind(wx.EVT_CLOSE, self.OnExit)
45
42
 
46
- sbar = self.CreateStatusBar(2,wx.CAPTION|wx.THICK_FRAME)
43
+ sbar = self.CreateStatusBar(2,wx.CAPTION)
47
44
  sfont = sbar.GetFont()
48
45
  sfont.SetWeight(wx.BOLD)
49
46
  sfont.SetPointSize(11)
@@ -83,8 +80,8 @@ class StripChartFrame(wx.Frame):
83
80
  self.SetSizer(mainsizer)
84
81
  mainsizer.Fit(self)
85
82
 
86
- wx.EVT_TIMER(self, ID_TIMER, self.onTimer)
87
- self.timer = wx.Timer(self, ID_TIMER)
83
+ self.Bind(wx.EVT_TIMER, self.onTimer)
84
+ self.timer = wx.Timer(self)
88
85
  self.Refresh()
89
86
 
90
87
  def write_message(self, msg, panel=0):
@@ -0,0 +1,12 @@
1
+ import sys
2
+ import wx
3
+ from tifffile import imread
4
+ from wxmplot import ImageFrame
5
+
6
+ img = imread('Pilatus.tiff')
7
+
8
+ app = wx.App()
9
+ frame = ImageFrame()
10
+ frame.display(img)
11
+ frame.Show()
12
+ app.MainLoop()