/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pyautogui__keyboard__examples/pressed_keys.py
25 строк
594 B
gil9red
Refactoring. Using black code style
03 июн 2023, 14:15
03 июн 2023, 14:15
13d8f05
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # SOURCE: https://github.com/boppreh/keyboard/blob/master/examples/pressed_keys.py """ Prints the scan code of all currently pressed keys. Updates on every keyboard event. """ # pip install keyboard import keyboard def print_pressed_keys(e): line = ", ".join(str(code) for code in keyboard._pressed_events) # '\r' and end='' overwrites the previous line. # ' ' * 40 prints 40 spaces at the end to ensure the previous line is cleared. print("\r" + line + " " * 40, end="") keyboard.hook(print_pressed_keys) keyboard.wait()