We’ll be using two methods of the PyAutoGUI module.
click()
This method is used to send a virtual mouse click to the computer and by default, it uses the left mouse button.
Syntax: pyautogui.click()
Parameters: It takes three parameters. x – coordinate, y – coordinate and duration which is optional.
Return type: Doesn’t return anything, simply performs a click.
For example, pyautogui.click(10, 5, button=’left’) will click the left mouse button at the coordinates (10, 5).
dragRel()
This method is used to drag the mouse. By dragging, we mean holding the mouse button and dragging the cursor. It also takes 3 arguments; x – coordinate, y – coordinate and button (this is optional).
Syntax: pyautogui.dragRel()
Parameters: It takes three parameters. x – coordinate, y – coordinate and duration which is optional.
Return type: Returns nothing, just drags the mouse cursor to the specified location in the form of parameters.
For example, pyautogui.dragRel(20, 40, 5) will drag the mouse cursor to the specified location in the form of the parameter.
Python Automation Drawing In Paint Application
In this article, we are going to know how to automate paint applications using Python.