Mar 26, 2023

[Python] pyautogui module 기본 함수 (Basic functions of pyautogui module)

 * Reference: https://pyautogui.readthedocs.io/en/latest/


import pyautogui

# Get the size of the screen primary monitor.
screen_width, screen_height = pyautogui.size()
print(screen_width, screen_height)

# Get the XY position of the mouse.
current_mouse_x, current_mouse_y = pyautogui.position()
print(current_mouse_x, current_mouse_y)

# Move the mouse to XY coordinates.
pyautogui.moveTo(500, 500)

# Click the mouse.
pyautogui.click()

# Move the mouse to XY coordinates and click it.
pyautogui.click(100, 200)

# Move the mouse 500 pixels to the right of its current position.
pyautogui.move(500, 0)

# Double click the mouse.
pyautogui.doubleClick()

# Type with quarter-second pause in between each key.
pyautogui.write("Hello, world!", interval = 0.25)

No comments:

Post a Comment