def isInside(self, cursor): pen = PointInsidePen(None, cursor) for i, point in enumerate(self.activeAreaRect): if i == len(self.activeAreaRect) - 1: pen.lineTo(point) pen.closePath() break elif i == 0: pen.moveTo(point) else: pen.lineTo(point) result = pen.getResult() if result: self.bcColor = 0, 0, 1, .3 else: self.bcColor = 1, 0, 0, .3 return result