]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/PyPlot.py
Simplified and extended compiler detection for OS/2.
[wxWidgets.git] / wxPython / demo / PyPlot.py
CommitLineData
9d6685e2
RD
1
2import wx
3import wx.lib.plot
4
5################################################################\
6# Where's the code??? |
7# |
8# wx.lib.plot.py came with its own excellent demo built in, |
9# for testing purposes, but it serves quite well to demonstrate |
10# the code and classes within, so we are simply borrowing that |
60d8ee39 11# code for the demo. Please load up wx.lib.plot.py for a review |
9d6685e2
RD
12# of the code itself. The demo/test is at the bottom of |
13# the file, as expected. |
14################################################################/
15
5523df9f
RD
16#---------------------------------------------------------------------------
17
18class TestPanel(wx.Panel):
19 def __init__(self, parent, log):
20 self.log = log
21 wx.Panel.__init__(self, parent, -1)
22
23 b = wx.Button(self, -1, "Show the PyPlot sample", (50,50))
24 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
25
26
27 def OnButton(self, evt):
28 win = wx.lib.plot.TestFrame(self, -1, "PlotCanvas Demo")
29 win.Show()
30
31#---------------------------------------------------------------------------
32
9d6685e2
RD
33
34def runTest(frame, nb, log):
5523df9f
RD
35 win = TestPanel(nb, log)
36 return win
37
9d6685e2
RD
38
39#----------------------------------------------------------------------
40
41overview = """\
42<html><body>
43<center><h2>PyPlot</h2></center>
44
45This demo illustrates the features of the new PyPlot modules, found
46in wx.lib.plot.py. All methods and functions are documented clearly
47therein; only the overview is included here.
48
49<p>
50PyPlot is an improvement over wxPlotCanvas, which is now deprecated.
51If you are using wxPlotCanvas now, please make plans to migrate in
52anticipation of the time that wxPlotCanvas disappears completely.
53
54<p>
55The demo illustrates four different plot styles (with appropriate
56variations on fonts, etc, to show how flexible it is) as well as
57provides you with a means to tinker with all the features that
58come with the class itself.
59
60<p><ul>
61<li>File Menu
62
63 <ul>
64 <li>Page Setup
65
60d8ee39 66 <p>This allows you to set up how the plot will be printed. This
9d6685e2
RD
67 is built into the library itself.
68
69 <li>Print Preview
70
60d8ee39 71 <p>As you might expect, this allows you to preview how the plot
9d6685e2
RD
72 will look when printed, in light of the page setup you may
73 have selected above.
74
75 <li>Print
76
653d2f0c 77 <p>Surprise! It prints the current plot to your printer! :-)
9d6685e2
RD
78
79 <li>Save Plot
80
60d8ee39 81 <p>That's right, the library even provides you with the means
9d6685e2
RD
82 to export the plotted data out to a graphics file. Several
83 formats are allowed for, basically any image class that
84 supports saving.
85 </ul>
86
87<li>Plot Menu
88
89 <ul>
90 <li>Plot 1 ... Plot 5
91
60d8ee39 92 <p>Different data with different plot formats, including one empty
9d6685e2
RD
93 plot.
94
95 <li>Enable Zoom
96
60d8ee39 97 <p>If Zoom is enabled, you can rubber-band select an area of the
9d6685e2
RD
98 plot to examine it in detail using the left mouse button. Right
99 mouse button zooms back out. This is automatically supported
100 by the library, all you have to do is turn it on.
101
102 <li>Enable Grid
103
60d8ee39 104 <p>Plots can have different styles of grids, and and these grids can
9d6685e2
RD
105 be turned on or off as needed.
106
107 <li>Enable Legend
108
60d8ee39 109 <p>Plot can have legends or not, the contents which are definable
9d6685e2
RD
110 by you.
111 </ul>
112</ul>
113
114<HR><pre>
115%s</pre>
116</body></html>
117""" % wx.lib.plot.__doc__
118
119
120if __name__ == '__main__':
121 import sys,os
122 import run
8eca4fef 123 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
9d6685e2 124