Skip to content

Commit

Permalink
slightly tidier KEY to char conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
paddywwoof committed Dec 1, 2013
1 parent f0af5c3 commit abca539
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import sys
import demo
import pi3d
# use tab for backspace and carriage return for delete
CHARS = {'KEY_SPACE':' ', 'KEY_BACKSPACE':'\t', 'KEY_DELETE':'\r',
'KEY_ENTER':'\n', 'KEY_COMMA':',', 'KEY_DOT':'.'}

def cbx(*args):
if radio.clicked:
Expand Down Expand Up @@ -120,14 +123,8 @@ def rotm(self, *args):
sh = True
if len(k) == 5:
this_key = k[4]
elif k == 'KEY_SPACE':
this_key = ' '
elif k == 'KEY_BACKSPACE':
this_key = '\t' # use tab for backspace
elif k == 'KEY_DELETE':
this_key = '\r' # use car ret for delete
elif k == 'KEY_ENTER':
this_key = '\n'
elif k in CHARS:
this_key = CHARS[k]
if this_key:
if not sh:
this_key = this_key.lower()
Expand Down

0 comments on commit abca539

Please sign in to comment.