platypush.plugins.inputs

class platypush.plugins.inputs.InputsPlugin(**kwargs)[source]

This plugin emulates user input on a keyboard/mouse. It requires the a graphical server (X server or Mac/Win interface) to be running - it won’t work in console mode.

Requires:

  • pyuserinput (pip install pyuserinput)
get_screen_size() → List[int][source]

Get the size of the screen in pixels.

mouse_click(x: int, y: int, btn: int, repeat: int = 1)[source]

Mouse click. :param x: x screen position :param y: y screen position :param btn: Button number (1 for left, 2 for right, 3 for middle) :param repeat: Number of clicks (default: 1)

press_key(key: str)[source]

Emulate the pressure of a key. :param key: Key to be pressed

press_keys(keys: List[str])[source]

Emulate the pressure of multiple keys. :param keys: List of keys to be pressed.

release_key(key: str)[source]

Release a pressed key. :param key: Key to be released

tap_key(key: str, repeat: int = 1, interval: float = 0)[source]

Emulate a key tap. :param key: Key to be pressed :param repeat: Number of iterations (default: 1) :param interval: Repeat interval in seconds (default: 0)

type_string(string: str, interval: float = 0)[source]

Type a string. :param string: String to be typed :param interval: Interval between key strokes in seconds (default: 0)