Skip to content

Instantly share code, notes, and snippets.

@gferreira
Created July 5, 2015 12:45
Show Gist options
  • Save gferreira/10da8431c22a205d4ca1 to your computer and use it in GitHub Desktop.
Save gferreira/10da8431c22a205d4ca1 to your computer and use it in GitHub Desktop.
Simple object example in DrawBot
class Square(object):
fillColor = 1, 0, 0
def __init__(self, side):
self.side = side
def draw(self, pos):
x, y = pos
fill(*self.fillColor)
rect(x, y, self.side, self.side)
S = Square(200)
S.draw((120, 200))
S.fillColor = 0, 1, 0
S.draw((300, 500))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment