Advertisement
Eredumbdumb

flowerissue #01

Jan 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. ''' CIS 210 Project 2-3: Draw Flower
  2. Author:
  3. Credits: N/A
  4. An introduction into importing modules, functions that return
  5. None; side effects, Python graphics module (turtle graphics).
  6. Also I'm learning how to draw a flower ^^
  7. '''
  8. '''    
  9. The function drawFlower draws a flower by calling on the
  10. function drawPolygon multiple times, creating an array of
  11. what is supposed to look like petals on a single point. The
  12. function will draw a "stem" before starting the array which
  13. is also kind of important.
  14. '''
  15. import turtle           #first we gotta bring up the turtle
  16. turtle                  #module since we can't draw anything
  17. t = turtle.Turtle()     #without it ^^
  18.  
  19. from turtle import *
  20.  
  21. #I'll just define sideLength so I won't have to it repeatedly
  22.  
  23. sideLength = 25
  24.  
  25.  
  26. def drawPolygon(myTurtle):
  27.  
  28. '''
  29. drawPolygon is a function that creates a square of length/width
  30. of 25. It's main purpose is to draw the petals that drawFlower
  31. will be using
  32. '''
  33.         for i in range(4):
  34.     myTurtle.forward(sideLength)
  35.     myTurtle.right(90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement