Coding Club
Python turtle and tkinter
Six projects in Python, the language professional programmers use every day. The turtle draws as you code, so you see every line work, and tkinter lets you build real apps with windows and buttons.
Six days, six projects
One small project a session. Each one is a numbered list of steps with a picture of what to click and what you should see, then tests and stretch challenges for anyone who finishes early.
Get set up before day 1
You will need
- A computer with Thonny (free from thonny.org) or IDLE
- A folder to save your programs in
- No account and no internet once Thonny is installed
Setup step 1: Open Thonny
Thonny is a free Python editor made for learning. On a school computer, click Start, type Thonny and press Enter. At home, download it free from thonny.org.
The big white area at the top is the editor, where you write your program. The area underneath is the Shell, where Python shows anything your program prints.
NewLoadSaveRunDebugStep overStep intoStep outResumeStop<untitled>1Shell>>>Thonny: the editor at the top, the Shell underneath. Setup step 2: Make a new file and save it
Click New, then Save. Choose a folder you can find again, such as your Documents folder or your school drive, type a name for the file, such as
hello.py, and click Save.NewLoadSaveRunDebugStep overStep intoStep outResumeStop<untitled>1Shell>>>Click New (1), then Save (2). NewLoadSaveRunDebugStep overStep intoStep outResumeStophello.py1Shell>>>DocumentsFile name:hello.pySave as type:Python files (*.py)SaveCancelType the name of the file and click Save. Watch out Never call a fileturtle.pyortkinter.py. Python would load your file instead of its own turtle or tkinter, and nothing would work.Setup step 3: Write a program and run it
Type this line into the editor, exactly as it is. Then click the green Run button, or press F5. The Shell shows what the program prints.
1print("Hello, Coding Club!")NewLoadSaveRunDebugStep overStep intoStep outResumeStophello.py1print("Hello, Coding Club!")Shell>>> %Run hello.pyHello, Coding Club!>>>Click Run: the Shell says Hello, Coding Club! Tip Thonny saves your file every time you press Run, so you never lose your work.Setup step 4: No Thonny? Run it on this page
Every turtle and tkinter program on these pages has a Run it here button, which runs it in your browser: handy at home, or to check what a step should do.
IDLE, which comes with Python, works too. Open it from the Start menu, click File then New File, type your program, save it, and press F5 to run it.
Notes for the teacher
Before the first session
- Check that Thonny is installed on the club's computers. It is free from thonny.org and comes with its own Python, so nothing else is needed. If installing is not possible, IDLE, which comes with every Python for Windows, works for all six projects.
- Make sure students can save to a folder they can find again, such as a Coding Club folder on the school drive.
- Every turtle and tkinter program on these pages has a Run it here button that runs it in the browser, so students can also work at home without installing anything.
How the six projects build up
Days 1 to 4 use the turtle: sequence and loops, then variables and lists, then functions with parameters, then random numbers, while and if. Days 5 and 6 use tkinter for event driven apps with buttons. Each day reuses something from the day before, but every project starts from an empty file, so a student who missed a session can still join in.