import wx hadImportError = False try: import wx.lib.plot except ImportError: hadImportError = True ################################################################\ # Where's the code??? | # | # 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.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): if not hadImportError: win = TestPanel(nb, log) else: from Main import MessagePanel win = MessagePanel(nb, """\ This demo requires the Numeric or numarray module, which could not be imported. It probably is not installed (it's not part of the standard Python distribution). See the Python site (http://www.python.org) for information on downloading source or binaries.""", 'Sorry', wx.ICON_WARNING) return win #---------------------------------------------------------------------- if hadImportError: overview = "" else: overview = """\

PyPlot

This demo illustrates the features of the new PyPlot modules, found in wx.lib.plot.py. All methods and functions are documented clearly therein; only the overview is included here.

PyPlot is an improvement over wxPlotCanvas, which is now deprecated. If you are using wxPlotCanvas now, please make plans to migrate in anticipation of the time that wxPlotCanvas disappears completely.

The demo illustrates four different plot styles (with appropriate variations on fonts, etc, to show how flexible it is) as well as provides you with a means to tinker with all the features that come with the class itself.


%s
""" % wx.lib.plot.__doc__ if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])