ABSP, Ch 18, Practice Project #1

My solution to the Practice Project #1 in Chapter 18 of the excellent book “Automate the Boring Stuff with Python” (ABSP)

#! usr/bin/env python3
# by lorenzo - 23/10/2017
# script that nudges the mouse cursor slightly every ten seconds

import pyautogui, time

print("Move the cursor to the upper-left corner of the screen to stop.")
pyautogui.FAILSAFE = True
    while True:
        pyautogui.moveRel(10, 0, duration=1)
        pyautogui.moveRel(-10, 0, duration=1)

except pyautogui.FailSafeException:

Comments about the code are welcome.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s