Created
July 5, 2015 12:45
-
-
Save gferreira/10da8431c22a205d4ca1 to your computer and use it in GitHub Desktop.
Simple object example in DrawBot
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
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