def OnMouseLeftButtonDown(self, sender, e): self.click = e.GetPosition(self.root) self.sx = Canvas.GetLeft(self.obj) self.sy = Canvas.GetTop(self.obj) if (self.sx.IsNaN(self.sx)): self.sx = 0.0 if (self.sy.IsNaN(self.sy)): self.sy = 0.0 self.obj.CaptureMouse()
def isCollision(self, x, y): width = self.Width height = self.Height if y <= 0 or y >= height: return True if x >= width: return not ((height / 2 + 15) > y > (height / 2 - 15)) for star in self.stars: testX = x - Canvas.GetLeft(star) testY = y - Canvas.GetTop(star) if mvvm.CheckCollisionPoint(Point(testX, testY), star): return True