LEARNING · FIRST CODE
Python turtle: your first code, drawing a triangle and a star
Python turtle graphics tutorial
The official Python documentation has a short turtle-graphics tutorial. You type a few commands and watch an arrow draw on screen. You finish with a red-and-yellow star made by a simple loop, code that repeats. It is a free, relaxed first coding session for a laptop or desktop.
This suits a teen or adult who has never coded and wants to see something happen right away. Python is free to use. 1) Open a Python shell. Type from turtle import *, then showturtle() to open the drawing window. 2) Draw a triangle with forward(100) and left(120), three times. Change color() and width() and draw again. 3) Copy the tutorial's star loop. Set the colour to red and the fill to yellow, and call begin_fill(). Repeat forward(200) and left(170) until the turtle is back where it started. Then call end_fill(). Afterwards, change 170 to another angle and see what shape appears. The docs warn that turtle needs the tkinter module. The python.org installers for Windows and macOS include it. Some Linux systems package it separately, so check first.
- Turtle graphics is part of Python’s standard library; it is based on Logo drawing tools from 1967
- The official tutorial ends with a filled star drawn by one loop
- Turtle needs tkinter; python.org Windows and macOS installers include it
- Python uses an OSI-approved open-source licence and is free to use
Open the turtle tutorial in the Python docs
Source: Python documentation: turtle · checked 2026-11-08