Sophie

Sophie

distrib > Mandriva > current > i586 > by-pkgid > ae0a4f27f26602dc31c3bf35e18b5b19 > files > 570

python-enthought-chaco-3.4.0-2mdv2010.2.i586.rpm

#!/usr/bin/env python
#
#
# Tutorial 9b. Synchronize the Y data space as well,and add some tools.


from tutorial8 import PlotFrame
from enthought.chaco.tools.api import ZoomTool

class PlotFrame2(PlotFrame):
    def _create_plot(self):
        container = super(PlotFrame2, self)._create_plot()
        
        self.right_plot.index_mapper.range = self.left_plot.index_mapper.range
        self.right_plot.value_mapper.range = self.left_plot.value_mapper.range
        
        self.left_plot.overlays.append(ZoomTool(self.left_plot, 
                tool_mode="box", always_on=False))
        self.right_plot.overlays.append(ZoomTool(self.right_plot,
                tool_mode="box", always_on=False))

        return container

if __name__ == "__main__":
    import wx
    app = wx.PySimpleApp()
    frame = PlotFrame2(None)
    app.MainLoop()