summaryrefslogtreecommitdiff
path: root/host/inter/dist_sensor.py
diff options
context:
space:
mode:
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):