Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. # Your name:
  2. # Your username:
  3. # Your partner's name (if applicable):
  4. # Your partner's username (if applicable):
  5. # CS111 PS03 Task 2
  6. # butterflies.py
  7. # Submission date:
  8.  
  9. from cs1graphics import *
  10. from cs1graphicsHelper import *
  11. from graphicsState import *
  12.  
  13. #******************************************************************************
  14. # Put your makeWing function definition here
  15. #******************************************************************************
  16. def makeWing (wingColor, spotColor):
  17. wing = Layer()
  18.  
  19. ellipse = Ellipse(200, 100, Point(100, 50))
  20. ellipse.setFillColor(wingColor)
  21. wing.add(ellipse)
  22.  
  23. circle = Circle(35, Point(150, 50))
  24. circle.setFillColor(spotColor)
  25. wing.add(circle)
  26.  
  27. dot = Circle(3, Point(0,0))
  28. dot.setFillColor('cyan')
  29. wing.add(dot)
  30.  
  31. return wing
  32.  
  33.  
  34.  
  35. #******************************************************************************
  36. # Put your makeWingPair function definition here
  37. #******************************************************************************
  38.  
  39.  
  40. #******************************************************************************
  41. # Put your makeButterfly function definition here
  42. #******************************************************************************
  43.  
  44.  
  45. #******************************************************************************
  46. # Put your butteflySky function definition here
  47. #******************************************************************************
  48.  
  49. # Your butterflySky definition should flesh out this *exact* skeleton:
  50.  
  51. """
  52. def butterflySky():
  53. sky = Canvas(... add parameters here ...)
  54. sky.add(makeButterfly(... add parameters here ...))
  55. sky.add(makeButterfly(... add parameters here ...))
  56. sky.add(makeButterfly(... add parameters here ...))
  57. sky.add(makeButterfly(... add parameters here ...))
  58. sky.add(makeButterfly(... add parameters here ...))
  59. # drawGrid(sky, 50) # Uncomment this line to draw grid
  60. # drawReferencePoints(sky) # Uncomment this line to draw reference points
  61. """
  62.  
  63. #******************************************************************************
  64. # Testing functions. Do not modify any of these functions.
  65.  
  66. def testWing():
  67. canv = Canvas(250,400,'white','testWing')
  68.  
  69. w1 = makeWing('pink', 'yellow')
  70. w1.moveTo(25,75)
  71. canv.add(w1)
  72.  
  73. w2 = makeWing('green', 'orange')
  74. w2.moveTo(125,150)
  75. w2.rotate(90)
  76. canv.add(w2)
  77. drawGrid(canv, 50)
  78.  
  79. def testWingPair():
  80. canv = Canvas(350,550,'white','testWingPair')
  81.  
  82. wp1 = makeWingPair('pink', 'yellow')
  83. wp1.moveTo(75,200)
  84. canv.add(wp1)
  85.  
  86. wp2 = makeWingPair('green', 'orange')
  87. wp2.moveTo(150,350)
  88. wp2.rotate(90)
  89. canv.add(wp2)
  90. drawGrid(canv, 50)
  91.  
  92. def testButterfly():
  93. canv = Canvas(800,700,'white','testButterfly')
  94. canv.add(makeButterfly('purple', 'yellow', 250, 200, 1, 0))
  95. canv.add(makeButterfly('green', 'orange', 500, 450, 1.5, -30))
  96. drawGrid(canv, 50)
  97.  
  98. #******************************************************************************
  99. # Testing block. Put all testing code indented inside this if block
  100. # Uncomment existing calls inside this testing block to run them
  101. # when you press the green run function in Canopy.
  102.  
  103. if __name__ == "__main__":
  104. '''All your testing code should go below.
  105. Uncomment and comment particular lines as appropriate.'''
  106. testWing()
  107. #testWingPair()
  108. #testButterfly()
  109. #butterflySky()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement