How to use pyautogui python library
In this article, I am going to show you how to use the library.
So, first, let us know what is pyautogui and what is it used for?.
What is pyautogui, and what is it used for
pyautogui is a library in which you can control mouse and keyboard accessible. For example, you would make a script that does something automatically on your computer.
for install the library you can copy the command below
pip install pyautogui
how to use PyAutoGUI
before using PyAutoGUI, we need to import the library module
1- getting current mouse
x means width
y means height
2.getting current screen resolutions.
before we talk about the moving mouse, we need to know this code
When fail-safe mode is True, moving the mouse to the upper-left will raise a pyautogui.FailSafeException that can abort your program, so I recommended setting False.
In this example, we'll move the mouse to the center of the screen.
>>> pyautogui.size() #getting current screen resolutions Size(width=1440, height=900) # outpup / my current screen resolutions >>> 1440/2 # here i made a division to get middle of the width 720 >>> 900/2 # here i made a division to get middle of the height. 450 pyautogui.moveTo(720, 450,) # command to move mouse
for more informations, please visit the library document link
English today is not an art to be mastered it's just a tool to use to get a result