Click here for sample student pictures
NOTE on Sept 13, 11am - Added a file with the flower pattern in it that you can cut and paste to see it run. The file is below the picture of the flower pattern.
NOTE on Sept 12, 3pm - Added an example of a pattern of a flower below, and also gave a examples of turtle commands you have already used
There is no howto page for this assignment. All instructions are on this page.
Programming has long been used to create or supplement artistic works, from such as in exhibits in museums. Daily it is used by visual designers, artists, and architects to create their works. Software has engaged a new generation of visual artists to consider programming as an essential part of their creative practice.
Logo is a computer programming language designed to teach programming to children. It is a user-friendly, interpreted language, designed with a "low floor, high ceiling"; in other words, the designers of Logo intended for the language to allow novice programmers to get started quickly writing programs but also wanted the language to be powerful and extensive for more advanced users. In the last 40 years, Logo has also caused people to think differently about how to teach art, geometry, social science, and complex systems.
The basic commands to move and turn a "turtle" (originally a physical robot) are so much a part of programming history that they have been incorporated into almost every modern programming language, Python included. We will use this basic system to explore programming. Examples of using the turtle are given in the course textbook and you can use any of the Active Code boxes in the text book to complete this project if you do not yet have Eclipse installed.
In this assignment you will use the Python Turtle graphics to create a picture. This assignment will give you a chance to work on functions and loops and to learn new turtle functions. It is also a creative assignment that you can have some fun with. There are specific requirements you will need to follow to get full credit.
The textbook has already shown you several turtle commands. There are many more in Python's Turtle Graphics module.
Picture.py
draw
that has no
parameters, and that can only create
turtles and call other functions.
draw
.
if __name__ == '__main__': draw()
Here is example code for a function that draws a flower pattern. Also
is a statement that calls the function.
SINCE I AM GIVING YOU THIS FUNCTION, you can use it if you want, but it
does not count as one of the six functions that you are suppose to create!
If you modify it in some way, (possibly add colors or fill in), then you can count it
as one of your functions.
def flowerSquare(alex): for i in range(12): # repeat twelve times # draw a square alex.forward(50) alex.left(90) alex.forward(50) alex.left(90) alex.forward(50) alex.left(90) alex.forward(50) alex.left(90) # move 30 degrees alex.left(30) flowerSquare(alex)
and here is the picture of the flower pattern:
Here is a Python file turtleFlower.py that uses the flowerSquare function and draws a flower.
The textbook has already shown you several turtle methods.
For example, here are five turtle methods you have probably already used:
forward left right up down
There are many more in Python's Turtle Graphics module.
None of the following below count as the required fifteen different turtle methods.
# setup steps: no need to change for now import turtle # allows us to use the turtles library wn = turtle.Screen() # creates a graphics window def draw(): alex = turtle.Turtle() # create a turtle named alex if __name__ == '__main__': draw() # the next line should be the last line in the file wn.exitonclick() # window stays up til clicked on
You can start with this simple program, or snarf it or copy it from here.
''' Created on Sep 3, 2014 @author: YOUR NAME HERE ''' import turtle # allows us to use the turtles library wn = turtle.Screen() # creates a graphics window def rightAngle(turt): # This function is a sample, you can delete it turt.forward(100) turt.left(90) turt.forward(100) def draw(): alex = turtle.Turtle() # you can rename the turtle if you want rightAngle(alex) if __name__ == '__main__': draw() wn.exitonclick()
Your grade will be based on how well your program conforms to the
standards above and whether it draws a picture using the function
named draw
. It's possible to earn extra credit for
artistic creativity.
Submit your Python module using Ambient from Eclipse and the assignment named picture.
Picture.py
module