From 297f37560c89fa66a0341d3d87617801d2fbf39d Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 3 Mar 2009 00:59:20 +0100 Subject: * host/inter: - use io mex interface. --- host/inter/dist_sensor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'host/inter/dist_sensor.py') diff --git a/host/inter/dist_sensor.py b/host/inter/dist_sensor.py index b1bd0d0d..859b311f 100644 --- a/host/inter/dist_sensor.py +++ b/host/inter/dist_sensor.py @@ -22,17 +22,18 @@ # # }}} """Distance sensor.""" +from math import pi, cos, sin, sqrt from Tkinter import * from drawable import * +from utils.observable import Observable -from math import pi, cos, sin, sqrt - -class DistSensor (Drawable): +class DistSensor (Drawable, Observable): """A distance sensor.""" def __init__ (self, onto, pos, angle, range): Drawable.__init__ (self, onto) + Observable.__init__ (self) self.pos = pos self.angle = angle self.range = range @@ -66,6 +67,7 @@ class DistSensor (Drawable): d = m + f if self.distance is None or self.distance > d: self.distance = d + self.notify () return self.distance def draw (self): -- cgit v1.2.3