]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PyPlot.py
  11 ################################################################\ 
  12 # Where's the code???                                           | 
  14 # wx.lib.plot.py came with its own excellent demo built in,     | 
  15 # for testing purposes, but it serves quite well to demonstrate | 
  16 # the code and classes within, so we are simply borrowing that  | 
  17 # code for the demo. Please load up wx.lib.plot.py for a review | 
  18 # of the code itself. The demo/test is at the bottom of         | 
  19 # the file, as expected.                                        | 
  20 ################################################################/ 
  22 #--------------------------------------------------------------------------- 
  24 class TestPanel(wx
.Panel
): 
  25     def __init__(self
, parent
, log
): 
  27         wx
.Panel
.__init
__(self
, parent
, -1) 
  29         b 
= wx
.Button(self
, -1, "Show the PyPlot sample", (50,50)) 
  30         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
  33     def OnButton(self
, evt
): 
  34         win 
= wx
.lib
.plot
.TestFrame(self
, -1, "PlotCanvas Demo") 
  37 #--------------------------------------------------------------------------- 
  40 def runTest(frame
, nb
, log
): 
  41     if not hadImportError
: 
  42         win 
= TestPanel(nb
, log
) 
  44         from Main 
import MessagePanel
 
  45         win 
= MessagePanel(nb
, """\ 
  46 This demo requires the Numeric or numarray module, 
  47 which could not be imported.  It probably is not installed 
  48 (it's not part of the standard Python distribution). See the 
  49 Python site (http://www.python.org) for information on 
  50 downloading source or binaries.""", 
  51                            'Sorry', wx
.ICON_WARNING
) 
  56 #---------------------------------------------------------------------- 
  63 <center><h2>PyPlot</h2></center> 
  65 This demo illustrates the features of the new PyPlot modules, found 
  66 in wx.lib.plot.py. All methods and functions are documented clearly 
  67 therein; only the overview is included here. 
  70 PyPlot is an improvement over wxPlotCanvas, which is now deprecated. 
  71 If you are using wxPlotCanvas now, please make plans to migrate in 
  72 anticipation of the time that wxPlotCanvas disappears completely. 
  75 The demo illustrates four different plot styles (with appropriate 
  76 variations on fonts, etc, to show how flexible it is) as well as 
  77 provides you with a means to tinker with all the features that 
  78 come with the class itself. 
  86         <p>This allows you to set up how the plot will be printed. This 
  87         is built into the library itself. 
  91         <p>As you might expect, this allows you to preview how the plot 
  92         will look when printed, in light of the page setup you may 
  97         <p>Surprise! It prints the current plot to your printer! :-) 
 101         <p>That's right, the library even provides you with the means 
 102         to export the plotted data out to a graphics file. Several 
 103         formats are allowed for, basically any image class that 
 110     <li>Plot 1 ... Plot 5 
 112         <p>Different data with different plot formats, including one empty 
 117         <p>If Zoom is enabled, you can rubber-band select an area of the 
 118         plot to examine it in detail using the left mouse button. Right 
 119         mouse button zooms back out. This is automatically supported 
 120         by the library, all you have to do is turn it on. 
 124         <p>Plots can have different styles of grids, and and these grids can 
 125         be turned on or off as needed. 
 129         <p>Plot can have legends or not, the contents which are definable  
 137 """ % wx
.lib
.plot
.__doc
__ 
 140 if __name__ 
== '__main__': 
 143     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])