Преглед на файлове

fix key number (name might be affected by modifiers)

Falko Schindler преди 3 години
родител
ревизия
7484b5614b
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      nicegui/events.py

+ 1 - 1
nicegui/events.py

@@ -50,7 +50,7 @@ class KeyboardKey(BaseModel):
     @property
     def number(self) -> Optional[int]:
         """Integer value of a number key."""
-        return int(self.name) if self.code.startswith('Digit') else None
+        return int(self.code.removeprefix('Digit')) if self.code.startswith('Digit') else None
 
     @property
     def backspace(self) -> bool: