Pynput (Robocorp Fork)

5.0.0 · active · verified Wed Apr 15

This is a maintained fork of the original `pynput` library (by TheMouseOrTheKeyboard), designed specifically for Robocorp's automation needs. It provides cross-platform control and monitoring of user input devices like keyboards and mice, essential for Robotic Process Automation (RPA). Version 5.0.0, released recently, focuses on Python 3.10+ compatibility and Linux environment improvements. Releases align with Robocorp's product development, typically with minor versions for bug fixes and improvements.

Warnings

Install

Imports

Quickstart

This example demonstrates how to use the keyboard controller to type a string, press and release a special key (Enter), and perform a key combination (Ctrl+C).

from pynput.keyboard import Controller, Key
import time

keyboard = Controller()

print("Typing 'Hello World'...")
keyboard.type('Hello World')

time.sleep(1)
print("Pressing Enter...")
keyboard.press(Key.enter)
keyboard.release(Key.enter)

time.sleep(1)
print("Pressing Ctrl+C...")
with keyboard.pressed(Key.ctrl):
    keyboard.press('c')
    keyboard.release('c')

print("Keyboard actions completed.")

view raw JSON →