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