Introduction to Python Turtle Module
Python distribution comes with many modules. One of those modules is the turtle module. The turtle module gives us tools to do graphics programming and make interesting shapes, drawings, and animations.
More reading at this link.
We used the tkinter and pygame modules to do Graphics programming on pages on this website. On this page, we will use Python Turtle module to develop graphics programming programs.
We will use the turtle module to draw several shapes. The example orograms will also use recursion using the turtle module. We introduced the subject of recursion on the LOGO Recursion page and Math Applications page.
You may recall that a function that calls itself within the function is called a recursive function. Recursive techniques enable the programmer to draw complex, intricate shapes. Two such designs are Koch Curve and Sierpinski Triangle. We will use the Python Turtle module and recursion to draw Koch Curve and Sierpinski Triangle.
The turtle module can also be used for game development. Game development is an exciting way to learn to program for the beginner. The programmer can use the Turtle module to develop simple games.
There is a simple game named “Turtle Race” at the end of this chapter. The reader can use it as a base to do more complex game development.
Copyright © 2019 – 2024 softwareprogramming4kids.com
All Rights Reserved