소스 검색

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: