Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' CIS 210 Project 2-3: Draw Flower
- Author:
- Credits: N/A
- An introduction into importing modules, functions that return
- None; side effects, Python graphics module (turtle graphics).
- Also I'm learning how to draw a flower ^^
- '''
- '''
- The function drawFlower draws a flower by calling on the
- function drawPolygon multiple times, creating an array of
- what is supposed to look like petals on a single point. The
- function will draw a "stem" before starting the array which
- is also kind of important.
- '''
- import turtle #first we gotta bring up the turtle
- turtle #module since we can't draw anything
- t = turtle.Turtle() #without it ^^
- from turtle import *
- #I'll just define sideLength so I won't have to it repeatedly
- sideLength = 25
- def drawPolygon(myTurtle):
- '''
- drawPolygon is a function that creates a square of length/width
- of 25. It's main purpose is to draw the petals that drawFlower
- will be using
- '''
- for i in range(4):
- myTurtle.forward(sideLength)
- myTurtle.right(90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement