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

« back to all changes in this revision

Viewing changes to examples/tutorials/tutorial6.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 6. Writing a tool
2
 
 
3
 
We write an interactor tha prints out all the events it receives.
4
 
"""
5
 
from chaco.api import AbstractController
6
 
 
7
 
from tutorial2 import demo
8
 
 
9
 
class EventPrinter(AbstractController):
10
 
    def dispatch(self, event, suffix):
11
 
        print suffix, "event received at (%d,%d)" % (event.x, event.y)
12
 
 
13
 
plot = demo.plot
14
 
plot.tools.append(EventPrinter(plot))
15
 
 
16
 
if __name__ == "__main__":
17
 
    demo.configure_traits()