def draw(self, canvas): x, y = canvas.pos_to_pixel(self.x, self.y) if self.valid: canvas.dc.SetPen(wx.Pen(self.dark_color, 2, wx.DOT)) else: canvas.dc.SetPen(wx.Pen(wx.Colour(255, 0, 0), 2, wx.DOT)) canvas.dc.DrawLine(x-200, y, x+200, y) Transform.draw(self, canvas)
def draw(self, canvas): dy = self.amount.y - self.y dx = self.amount.x - self.x if self.valid: canvas.dc.SetPen(wx.Pen(self.dark_color, 2, wx.DOT)) else: canvas.dc.SetPen(wx.Pen(wx.Colour(255, 0, 0), 2, wx.DOT)) x0, y0 = canvas.pos_to_pixel(self.x, self.y - dy) x1, y1 = canvas.pos_to_pixel(self.x, self.y + dy) offset = canvas.pos_to_pixel(dx) canvas.dc.DrawLine(x0, y0, x1, y1) canvas.dc.DrawLine(x0, y0, x0-offset, y0) canvas.dc.DrawLine(x1, y1, x1+offset, y1) canvas.dc.DrawLine(x0-offset, y0, x1+offset, y1) Transform.draw(self, canvas)
def __init__(self, name=str, x=float, y=float, target=MathString, amount=Point): Transform.__init__(self, name=name, x=x, y=y, target=target, amount=amount) self.dark_color = wx.Colour(190, 190, 0) self.light_color = wx.Colour(255, 255, 0)
def __init__(self, name=str, x=float, y=float, target=MathString): Transform.__init__(self, name=name, x=x, y=y, target=target)