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