Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created June 8, 2014 23:33
Show Gist options
  • Save jordanorelli/a17f73e09b6a05ef89c5 to your computer and use it in GitHub Desktop.
Save jordanorelli/a17f73e09b6a05ef89c5 to your computer and use it in GitHub Desktop.
currentFont = None
typing = ""
items = []
def setup():
global currentFont
size(500, 500)
currentFont = createFont("Courier", 16, True)
def draw():
global typing
background(255)
textFont(currentFont)
fill(0)
text(typing, 50, 50)
for item in items:
if callable(item):
try:
item()
except Exception as e:
print e
def keyPressed():
global typing
if key == '\r':
try:
exec typing
except Exception as e:
print e
typing = ""
else:
if isinstance(key, str) or isinstance(key, unicode):
typing = typing + key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment