Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Your name:
- # Your username:
- # Your partner's name (if applicable):
- # Your partner's username (if applicable):
- # CS111 PS03 Task 2
- # butterflies.py
- # Submission date:
- from cs1graphics import *
- from cs1graphicsHelper import *
- from graphicsState import *
- #******************************************************************************
- # Put your makeWing function definition here
- #******************************************************************************
- def makeWing (wingColor, spotColor):
- wing = Layer()
- ellipse = Ellipse(200, 100, Point(100, 50))
- ellipse.setFillColor(wingColor)
- wing.add(ellipse)
- circle = Circle(35, Point(150, 50))
- circle.setFillColor(spotColor)
- wing.add(circle)
- dot = Circle(3, Point(0,0))
- dot.setFillColor('cyan')
- wing.add(dot)
- return wing
- #******************************************************************************
- # Put your makeWingPair function definition here
- #******************************************************************************
- #******************************************************************************
- # Put your makeButterfly function definition here
- #******************************************************************************
- #******************************************************************************
- # Put your butteflySky function definition here
- #******************************************************************************
- # Your butterflySky definition should flesh out this *exact* skeleton:
- """
- def butterflySky():
- sky = Canvas(... add parameters here ...)
- sky.add(makeButterfly(... add parameters here ...))
- sky.add(makeButterfly(... add parameters here ...))
- sky.add(makeButterfly(... add parameters here ...))
- sky.add(makeButterfly(... add parameters here ...))
- sky.add(makeButterfly(... add parameters here ...))
- # drawGrid(sky, 50) # Uncomment this line to draw grid
- # drawReferencePoints(sky) # Uncomment this line to draw reference points
- """
- #******************************************************************************
- # Testing functions. Do not modify any of these functions.
- def testWing():
- canv = Canvas(250,400,'white','testWing')
- w1 = makeWing('pink', 'yellow')
- w1.moveTo(25,75)
- canv.add(w1)
- w2 = makeWing('green', 'orange')
- w2.moveTo(125,150)
- w2.rotate(90)
- canv.add(w2)
- drawGrid(canv, 50)
- def testWingPair():
- canv = Canvas(350,550,'white','testWingPair')
- wp1 = makeWingPair('pink', 'yellow')
- wp1.moveTo(75,200)
- canv.add(wp1)
- wp2 = makeWingPair('green', 'orange')
- wp2.moveTo(150,350)
- wp2.rotate(90)
- canv.add(wp2)
- drawGrid(canv, 50)
- def testButterfly():
- canv = Canvas(800,700,'white','testButterfly')
- canv.add(makeButterfly('purple', 'yellow', 250, 200, 1, 0))
- canv.add(makeButterfly('green', 'orange', 500, 450, 1.5, -30))
- drawGrid(canv, 50)
- #******************************************************************************
- # Testing block. Put all testing code indented inside this if block
- # Uncomment existing calls inside this testing block to run them
- # when you press the green run function in Canopy.
- if __name__ == "__main__":
- '''All your testing code should go below.
- Uncomment and comment particular lines as appropriate.'''
- testWing()
- #testWingPair()
- #testButterfly()
- #butterflySky()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement