Created
June 8, 2014 23:33
-
-
Save jordanorelli/a17f73e09b6a05ef89c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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