0% found this document useful (0 votes)
24 views1 page

1.1 Lesson48 Recap

The document discusses GUI automation using the PyAutoGUI third-party module which has functions to control the mouse and keyboard like getting screen resolution and mouse position, moving the mouse to coordinates, clicking buttons, and dragging. It also mentions moving the mouse to stop a program.

Uploaded by

Seaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

1.1 Lesson48 Recap

The document discusses GUI automation using the PyAutoGUI third-party module which has functions to control the mouse and keyboard like getting screen resolution and mouse position, moving the mouse to coordinates, clicking buttons, and dragging. It also mentions moving the mouse to stop a program.

Uploaded by

Seaman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Controlling the mouse and keyboard is called GUI automation.

The PyAutoGUI third-party module has many functions to control the mouse and
keyboard.
pyautogui.size() returns the screen resolution, pyautogui.position() returns the
mouse position. These are returned as tuples of two integers.
pyautogui.moveTo(x, y) moves the mouse to an x, y coordinate on the screen.
The mouse move is instantaneous, unless you pass an int for the "duration" keyword
argument.
pyautogui.moveRel() moves the mouse relative to its current position.
PyAutoGUI's click(), doubleClick(), rightClick(), and middleClick() click the mouse
buttons.
dragTo() and dragRel() will move the mouse while holding down a mouse button.
If your program gets out of control, quickly move the mouse cursor to the top-left
corner to stop it.
There's more documentation at pyautogui.readthedocs.org.

You might also like