Skip to content

Commit

Permalink
calc use an event "ev"
Browse files Browse the repository at this point in the history
  • Loading branch information
manatlan committed Mar 18, 2024
1 parent 0d95319 commit 2d19a78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ def init(self):
self <= Tag.button("=", _onclick=self.bind( self.compute ) )

#-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ with real keyboard
self["onkeyup"] = self.bind( self.presskey, b"event.key" )
self["onkeyup"] = self.presskey

def presskey(self,key):
def presskey(self,ev):
key=ev.key
if key in "0123456789+-*/.":
self.press(key)
elif key=="Enter":
Expand Down

0 comments on commit 2d19a78

Please sign in to comment.