Fixed pynput imports

This commit is contained in:
Sven Heidemann 2022-07-17 15:52:17 +02:00
parent 330d702347
commit 95159da0fc
2 changed files with 4 additions and 4 deletions

View File

@ -6,8 +6,6 @@ from typing import Union, Optional
from art import text2art from art import text2art
import colorama import colorama
from pynput import keyboard
from pynput.keyboard import Key
from tabulate import tabulate from tabulate import tabulate
from termcolor import colored from termcolor import colored
@ -173,7 +171,7 @@ class Console:
Console.write_line() Console.write_line()
@classmethod @classmethod
def _select_menu_key_press(cls, key: Key): def _select_menu_key_press(cls, key):
r"""Event function when key press is detected r"""Event function when key press is detected
Parameter Parameter
@ -181,6 +179,7 @@ class Console:
key: :class:`pynput.keyboard.Key` key: :class:`pynput.keyboard.Key`
Pressed key Pressed key
""" """
from pynput.keyboard import Key
if key == Key.down: if key == Key.down:
if cls._selected_menu_item_index == len(cls._select_menu_items) - 1: if cls._selected_menu_item_index == len(cls._select_menu_items) - 1:
return return
@ -400,6 +399,7 @@ class Console:
Console.write_line(message, '\n') Console.write_line(message, '\n')
cls._show_select_menu() cls._show_select_menu()
from pynput import keyboard
with keyboard.Listener( with keyboard.Listener(
on_press=cls._select_menu_key_press, suppress=False on_press=cls._select_menu_key_press, suppress=False
) as listener: ) as listener:

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "7", "Minor": "7",
"Micro": "0.post2" "Micro": "0.post3"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de", "AuthorEmail": "sven.heidemann@sh-edraft.de",