示例#1
0
 def draw(self):
     dth = math.pi/64
     x = 200
     y = 200
     for i in range(0,64):
         th = maps.slotToTheta(i)+math.pi
         self.canvas.create_line(x,y,x+150.*math.sin(th+dth), y+150.*math.cos(th+dth), fill="white", tag="axis")
         self.canvas.create_line(x,y,x+150.*math.sin(th-dth), y+150.*math.cos(th-dth), fill="white", tag="axis")
         for r in [50,100,150]:
             self.canvas.create_line(x+r*math.sin(th-dth), y+r*math.cos(th-dth), x+r*math.sin(th+dth), y+r*math.cos(th+dth), fill="white", tag="axis")
     """
示例#2
0
 def update(self):
     dth = (math.pi/64)*.9
     x = 200
     y = 200
     self.canvas.delete("plot")
     for i in range(0,64):
         th = maps.slotToTheta(i)+math.pi
         r = sonarWorld[i][0]/2.
         v = sonarWorld[i][1]/2.
         self.canvas.create_line(x+r*math.sin(th-dth), y+r*math.cos(th-dth),
                                 x+r*math.sin(th+dth), y+r*math.cos(th+dth), fill="blue", tag="plot")
         self.canvas.create_line(x+(r-v)*math.sin(th), y+(r-v)*math.cos(th),
                                 x+(r+v)*math.sin(th), y+(r+v)*math.cos(th), fill="blue", tag="plot")
         """
         self.canvas.create_arc(x-r, y-r, x+r, y+r,
                                start=math.degrees(th-dth), extent=math.degrees(2.*dth),
                                fill="blue", tag="plot")
         """
         
     """