Skip to content Skip to sidebar Skip to footer

Simulate The Print Screen Key In Python

i search lot in Google but i did not got anything . can we simulate the print screen key in python ? if yes then how to simulate the print screen key in python?

Solution 1:

To take a screen shot the comments you've been given will work:

Get screenshot on Windows with Python? python auto save printscreen

To simulate the print screen key you may use keystroke automation libraries, two of which I can attest work for this:

1: pywinauto

which uses SendKeys to simulate keystrokes (or see reference here).

2: Sikuli_cpython

which uses the standalone sikuli API to handle keystrokes and much much more. Here is then the list of keys you can simulate by passing the respective unicode char to the sikuli method type()


Solution 2:

You can use the pyautogui library:

#pip install pyautogui
from pyautogui import press
press("printscreen")

Post a Comment for "Simulate The Print Screen Key In Python"