~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to examples/tutorials/tutorial7.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2014-06-01 17:04:08 UTC
  • mfrom: (7.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140601170408-m86xvdjd83a4qon0
Tags: 4.4.1-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
 - Let the binary-predeb target work on the usr/lib/python* directory
   as we don't have usr/share/pyshared anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Tutorial 7. Writing a tool (cont.) - Looking at data space"""
2
 
 
3
 
from chaco.api import AbstractController
4
 
 
5
 
from tutorial2 import demo
6
 
 
7
 
class DataPrinter(AbstractController):
8
 
    def dispatch(self, event, suffix):
9
 
        x = self.component.x_mapper.map_data(event.x)
10
 
        y = self.component.y_mapper.map_data(event.y)
11
 
        print suffix, "event received at (%f,%f)" % (x, y)
12
 
 
13
 
plot = demo.plot
14
 
plot.tools.append(DataPrinter(component=plot))
15
 
 
16
 
if __name__ == "__main__":
17
 
    demo.configure_traits()