Esempio n. 1
0
def drag_drop(drag_from, drop_to, duration=None):
    """Mouse drag and drop.

    :param drag_from: Starting point for drag and drop. Can be pattern, string or location.
    :param drop_to: Ending point for drag and drop. Can be pattern, string or location.
    :param duration: Speed of drag and drop.
    :return: None.
    """

    if duration is None:
        duration = Settings.move_mouse_delay

    # Ensure Iris has time to get correct target coordinates before initiating DnD.
    time.sleep(Settings.UI_DELAY)
    from_location = to_location(ps=drag_from, align='center')
    _to_location = to_location(ps=drop_to, align='center')
    pyautogui.moveTo(from_location.x, from_location.y, 0)

    time.sleep(Settings.delay_before_mouse_down)
    pyautogui.mouseDown(button='left', _pause=False)

    time.sleep(Settings.delay_before_drag)
    pyautogui._mouseMoveDrag('drag', _to_location.x, _to_location.y, 0, 0,
                             duration, pyautogui.linear, 'left')

    time.sleep(Settings.delay_before_drop)
    pyautogui.mouseUp(button='left', _pause=False)
Esempio n. 2
0
def id_pen(data):
    x = round(((data[3] * 255 + data[2]) / PEN_MAX_X) * 1366)
    y = round(((data[5] * 255 + data[4]) / PEN_MAX_Y) * 768)
    # pyautogui.moveTo(x, y, duration=0.0)
    pyautogui._mouseMoveDrag('move', x, y, 0, 0, 0, None)