Sophie

Sophie

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

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

#!/usr/bin/env python
#
#
# Tutorial 6. Writing a tool

from enthought.chaco.api import AbstractController

# This interactor just prints out all the events it receives
class EventPrinter(AbstractController):
    def dispatch(self, event, suffix):
        print suffix, "event received at (%d,%d)" % (event.x, event.y)


from tutorial2 import myplot, PlotFrame, main

myplot.tools.append(EventPrinter(myplot))


if __name__ == "__main__":
    main()