Esempio n. 1
0
    def wait_till_reached(self, pt, timeout):
        pos = Mouse.get_cursor_pos()

        max_time = Utility.TimestampMillisec64() + timeout * 1000

        in_accuracy = abs(pos[0] - pt[0]) + abs(pos[1] - pt[1])

        while in_accuracy > 4:
            time.sleep(0.05)
            pos = Mouse.get_cursor_pos()

            if Utility.TimestampMillisec64() > max_time:
                return False

            in_accuracy = abs(pos[0] - pt[0]) + abs(pos[1] - pt[1])

        return True
Esempio n. 2
0
    def is_mouse_over(self):
        c_pos = Mouse.get_cursor_pos()

        return c_pos[0] >= self.pt[0] - self.margin and c_pos[0] < self.pt[0] + self.w + self.margin\
        and c_pos[1] >= self.pt[1] - self.margin and c_pos[1] < self.pt[1] + self.h + self.margin