File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
general/keyboard-controller Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1010# check if a ctrl is pressed
1111print (keyboard .is_pressed ('ctrl' ))
1212
13- # press space
13+ # press and release space
1414keyboard .send ("space" )
1515
16+ # multi-key, windows+d as example shows the desktop in Windows machines
17+ keyboard .send ("windows+d" )
18+
19+ # send ALT+F4 in the same time, and then send space,
20+ # (be carful, this will close any current open window)
21+ keyboard .send ("alt+F4, space" )
22+
23+ # press CTRL button
24+ keyboard .press ("ctrl" )
25+ # release the CTRL button
26+ keyboard .release ("ctrl" )
27+
1628# sends artificial keyboard events to the OS
1729# simulating the typing of a given text
1830# setting 0.1 seconds to wait between keypresses to look fancy
2234events = keyboard .record ('esc' )
2335# play these events
2436keyboard .play (events )
37+ # print all typed strings in the events
38+ print (list (keyboard .get_typed_strings (events )))
39+
40+ # log all pressed keys
41+ keyboard .on_release (lambda e : print (e .name ))
2542
2643# remove all keyboard hooks in use
2744keyboard .unhook_all ()
You can’t perform that action at this time.
0 commit comments