useful_scripts/check_curses_key.py

18 lines
393 B
Python
Raw Permalink Normal View History

2024-04-13 18:57:11 +00:00
import time
import curses
2024-04-23 03:55:42 +00:00
2024-04-13 18:57:11 +00:00
def draw(canvas):
2024-04-23 03:55:42 +00:00
canvas.keypad(True) # нужно для работы с клавишами F1-F4
2024-04-13 18:57:11 +00:00
while True:
key = canvas.getkey()
if key == ("\x1b"):
print(f"Вы ввели Escape!")
2024-04-23 03:55:42 +00:00
print(f"Вы ввели {key.encode()}")
2024-04-13 18:57:11 +00:00
if __name__ == '__main__':
curses.update_lines_cols()
curses.wrapper(draw)