X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d6685e21c32c9a7ae18c5e3a4b39b5466614e46..6a52ea5cb81dcd07c286d34b80945534780fe05f:/wxPython/demo/PyPlot.py diff --git a/wxPython/demo/PyPlot.py b/wxPython/demo/PyPlot.py index 3f004249d8..f916dc6615 100644 --- a/wxPython/demo/PyPlot.py +++ b/wxPython/demo/PyPlot.py @@ -1,7 +1,3 @@ -# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o New demo -# import wx import wx.lib.plot @@ -12,19 +8,33 @@ import wx.lib.plot # wx.lib.plot.py came with its own excellent demo built in, | # for testing purposes, but it serves quite well to demonstrate | # the code and classes within, so we are simply borrowing that | -# code for the demo. Please load up wx.py.plot.py for a review | +# code for the demo. Please load up wx.lib.plot.py for a review | # of the code itself. The demo/test is at the bottom of | # the file, as expected. | ################################################################/ -#---------------------------------------------------------------------- +#--------------------------------------------------------------------------- + +class TestPanel(wx.Panel): + def __init__(self, parent, log): + self.log = log + wx.Panel.__init__(self, parent, -1) + + b = wx.Button(self, -1, "Show the PyPlot sample", (50,50)) + self.Bind(wx.EVT_BUTTON, self.OnButton, b) + + + def OnButton(self, evt): + win = wx.lib.plot.TestFrame(self, -1, "PlotCanvas Demo") + win.Show() + +#--------------------------------------------------------------------------- + def runTest(frame, nb, log): - # Loading the demo class directly from the library's - # test code. - win = wx.lib.plot.TestFrame(nb, -1, "PlotCanvas Demo") - frame.otherWin = win - return None + win = TestPanel(nb, log) + return win + #---------------------------------------------------------------------- @@ -53,22 +63,22 @@ come with the class itself.
This allows you to set up how the plot will be printed. This is built into the library itself.
As you might expect, this allows you to preview how the plot will look when printed, in light of the page setup you may have selected above.
Surprise! It prints the current plot to your printer! :-)
That's right, the library even provides you with the means to export the plotted data out to a graphics file. Several formats are allowed for, basically any image class that supports saving. @@ -79,24 +89,24 @@ come with the class itself.
Different data with different plot formats, including one empty plot.
If Zoom is enabled, you can rubber-band select an area of the plot to examine it in detail using the left mouse button. Right mouse button zooms back out. This is automatically supported by the library, all you have to do is turn it on.
Plots can have different styles of grids, and and these grids can be turned on or off as needed.
Plot can have legends or not, the contents which are definable by you.