def _on_left_down(self, event): #TODO: change event to fire with mouse key down, not only at the moment press dxy = event.GetPosition() dc = wx.ClientDC(self.canvas) dc.SetPen(wx.Pen('WHITE', 1)) self.canvas.Draw(True) dc.DrawLine(self.canvas_size / 2, self.canvas_size / 2, dxy[0], dxy[1]) dc.DrawCircle(dxy[0], dxy[1], 3) coordinates = event.GetCoords() self.runner(self.bot.shift_body_angle, MathTools.coordinates2angle(*coordinates), MathTools.vector_length(*coordinates)) self.runner(self.bot.sleep, 0.5)
def _on_left_down(self, event): #TODO: change event to fire with mouse key down, not only at the moment press dxy = event.GetPosition() dc = wx.ClientDC(self.canvas) dc.SetPen(wx.Pen('WHITE', 1)) self.canvas.Draw(True) dc.DrawLine(self.canvas_size / 2, self.canvas_size / 2, dxy[0], dxy[1]) dc.DrawCircle(dxy[0], dxy[1], 3) coordinates = event.GetCoords() angle = MathTools.interpolate(MathTools.vector_length(coordinates[0], coordinates[1]), 0, self.canvas_size, 0, 30) self.runner(self.bot.rotate_body, angle, (coordinates[1], -coordinates[0], 0)) self.runner(self.bot.sleep, 0.5)