From charlesreid1

(Created page with "Link: https://github.com/boppreh/keyboard The keyboard library allows you to control the keyboard directly from Python. {{PythonFlag}}")
 
No edit summary
Line 1: Line 1:
==Notes==
Link: https://github.com/boppreh/keyboard
Link: https://github.com/boppreh/keyboard


The keyboard library allows you to control the keyboard directly from Python.  
The keyboard library allows you to control the keyboard directly from Python.  
A short example of what you can do with the library:
<pre>
import keyboard
keyboard.press_and_release('shift+s, space')
keyboard.write('The quick brown fox jumps over the lazy dog.')
# Press PAGE UP then PAGE DOWN to type "foobar".
keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar'))
# Blocks until you press esc.
keyboard.wait('esc')
# Record events until 'esc' is pressed.
recorded = keyboard.record(until='esc')
# Then replay back at three times the speed.
keyboard.play(recorded, speed_factor=3)
# Type @@ then press space to replace with abbreviation.
keyboard.add_abbreviation('@@', 'my.long.email@example.com')
# Block forever.
keyboard.wait()
</pre>
==Flags==


{{PythonFlag}}
{{PythonFlag}}

Revision as of 08:49, 14 August 2017

Notes

Link: https://github.com/boppreh/keyboard

The keyboard library allows you to control the keyboard directly from Python.

A short example of what you can do with the library:

import keyboard

keyboard.press_and_release('shift+s, space')

keyboard.write('The quick brown fox jumps over the lazy dog.')

# Press PAGE UP then PAGE DOWN to type "foobar".
keyboard.add_hotkey('page up, page down', lambda: keyboard.write('foobar'))

# Blocks until you press esc.
keyboard.wait('esc')

# Record events until 'esc' is pressed.
recorded = keyboard.record(until='esc')
# Then replay back at three times the speed.
keyboard.play(recorded, speed_factor=3)

# Type @@ then press space to replace with abbreviation.
keyboard.add_abbreviation('@@', 'my.long.email@example.com')
# Block forever.
keyboard.wait()

Flags