Skip to content

Instantly share code, notes, and snippets.

@ahaym
Created January 11, 2022 19:10
Show Gist options
  • Save ahaym/eb48db23c3fc28ad1a9d42a288d839bd to your computer and use it in GitHub Desktop.
Save ahaym/eb48db23c3fc28ad1a9d42a288d839bd to your computer and use it in GitHub Desktop.
keyLabel = Label('>',100, 50, font='monospace', align='center')
def onKeyPress(key):
if key == 'backspace':
keyLabel.value = keyLabel.value[0:-1]
elif key == 'space':
keyLabel.value += ' '
elif key == 'enter':
eval(keyLabel.value[1:])
keyLabel.value = '>'
else:
keyLabel.value += key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment