summaryrefslogtreecommitdiff
path: root/host/inter/dist_sensor.py
diff options
context:
space:
mode:
authorNicolas Schodet2009-03-03 00:59:20 +0100
committerNicolas Schodet2009-03-03 00:59:20 +0100
commit297f37560c89fa66a0341d3d87617801d2fbf39d (patch)
tree00f47d8d0668d838fd90063492e1ed8a2433fbdb /host/inter/dist_sensor.py
parent4caec5a55ce87f0eec94f19bc1667f25a0a8ee60 (diff)
* host/inter:
- use io mex interface.
Diffstat (limited to 'host/inter/dist_sensor.py')
-rw-r--r--host/inter/dist_sensor.py8
1 files changed, 5 insertions, 3 deletions
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):