I want to automate desktop activities in Windows environment using Python. How it can be done? Some examples will also be helpful.
By desktop activities, I mean acti
You can use PyAutoGUI which provide a cross-platform Python way to perform GUI automation.
Here is a simple code to move the mouse to the middle of the screen:
import pyautogui
screenWidth, screenHeight = pyautogui.size()
pyautogui.moveTo(screenWidth / 2, screenHeight / 2)
Related question: Controlling mouse with Python.
Example:
pyautogui.typewrite('Hello world!') # prints out "Hello world!" instantly
pyautogui.typewrite('Hello world!', interval=0.25) # prints out "Hello world!" with a quarter second delay after each character
It provides JavaScript-style message boxes.
And other.
For other suggestions, check: Python GUI automation library for simulating user interaction in apps.