đ§ Setting up Thonny with py5 Mode
For students and parents: This guide will help you set up everything you need to start coding with Python and py5. Donât worry if youâre new to this - weâll explain each step!
đ¤ What are we installing?
đ What is Thonny?
Thonny is a simple code editor designed for beginners learning Python. Think of it like Google Docs or Microsoft Word, but for writing code instead of documents.
Why Thonny?
- Simple, clean interface - no confusing menus
- Built-in help for beginners
- Shows you exactly what your code is doing
- Free and works on all computers
đ¨ What is py5?
py5 is a Python library that lets you create visual art, games, and animations. If youâve used Scratch before, py5 gives you similar building blocks - but instead of dragging blocks, you type code!
With py5, you can:
- Draw shapes and colors
- Make interactive games
- Create animations
- Respond to mouse clicks and keyboard presses
The py5mode plugin makes it super easy to run py5 code in Thonny.
đ What Youâll Need
- A computer (Windows, Mac, or Linux)
- Internet connection (for downloading)
- About 10-15 minutes
Step 1: Download and Install Thonny
đĽ Download Thonny
- Go to thonny.org in your web browser
- Put your cursor on the download button for your computer to see the options, then click the first link:
- Windows: Hover over Windows, click the first option
- Mac: Hover over Mac, click the first option
- Linux: Hover over Linux, run the commands they give
đ¨ Install Thonny (Windows/Mac)
- Find the downloaded file (usually in your Downloads folder)
- Double-click the installer file
- Follow the installation steps:
- Click âNextâ or âContinueâ through the steps
- Accept the default settings (donât change anything)
- Wait for it to finish installing
Step 2: Install the py5mode Plugin
đ Launch Thonny
- Find Thonny on your computer:
- Windows: Look in the Start Menu
- Mac: Look in Applications folder or Launchpad
- Double-click to open Thonny
- If it asks about settings, choose âStandardâ (the default)
đ Install the Plugin
- In Thonny, click Tools in the top menu
- Choose âManage plug-insâŚâ
- In the search box, type exactly:
thonny-py5mode
- Click the blue âthonny-py5modeâ link when it appears
- Click the âInstallâ button
- Wait for it to download and install
- Close Thonny completely and reopen it
đĄ Can't find the plugin?
Make sure you:
- Spelled it exactly:
thonny-py5mode
(with hyphens) - Are connected to the internet
- Wait a moment for search results to appear
If it still doesnât work:
- Try closing and reopening the plug-in manager
- Make sure youâre using the latest version of Thonny
Step 3: Activate py5 Mode
đŻ Enable py5 Mode
After restarting Thonny, you should see a new âpy5â menu at the top.
- Click the âpy5â menu
- Choose âImported mode for py5â
- If prompted about downloading Java (JDK), click âYesâ or âAllowâ
- Wait for the download to complete (this only happens once!)
â Don't see the py5 menu?
The py5 menu should appear after installing the plugin and restarting Thonny.
If you donât see it:
- Make sure you completely closed and reopened Thonny
- Check that the plugin installed correctly (Tools > Manage plug-ins)
- Try restarting your computer
â What's this Java download about?
py5 needs Java to run (donât worry, you wonât need to learn Java!). Think of Java like the engine that powers py5âs graphics.
- This is a one-time download
- Itâs completely safe and automatic
- It might take a few minutes depending on your internet speed
Step 4: Test Your Setup
đ§Ş Run a Test Program
Letâs make sure everything works! Type this code into Thonny:
def setup():
size(400, 300)
background(200, 220, 255)
def draw():
fill(255, 100, 100)
circle(mouse_x, mouse_y, 30)
run_sketch()
âśď¸ Run It!
- Click the green âRunâ button (or press F5)
- You should see: A light blue window with a red circle that follows your mouse!
â Success! What just happened?
Congratulations! Your setup is working perfectly. Hereâs what the test code does:
setup()
: Creates a 400x300 pixel window with a light blue backgrounddraw()
: Runs 60 times per second, drawing a red circle wherever your mouse ismouse_x
andmouse_y
: Tell the program where your mouse is locatedrun_sketch()
: Starts the program running
Move your mouse around in the window and watch the circle follow it!
â Nothing happened?
No window appeared:
- Make sure you clicked the âRunâ button (green triangle)
- Check that py5 mode is activated (py5 menu should show a checkmark)
- Try restarting Thonny
Error messages:
- Make sure you typed the code exactly as shown
- Check that all the colons (:) are in the right places
- Make sure the lines are indented properly (use Tab or 4 spaces)
âpy5 is not definedâ error:
- py5 mode isnât activated - go back to Step 3
đ Youâre Ready to Code!
Congratulations! Youâve successfully set up Thonny with py5 mode. Youâre now ready to start creating games and animations with Python!
đ Whatâs Next?
đ Ready for your first project?
Now that your setup is complete, you can start with our interactive worksheets:
Click the Circle - Your First Game!
This worksheet will teach you:
- How to create a game window
- Drawing shapes and colors
- Detecting mouse clicks
- Keeping score
Donât worry about understanding everything at first - just type the code and see what happens!
đ Still Need Help?
đ Getting More Help
If youâre still having trouble:
- Ask your Code Club mentor - theyâre there to help with exactly these kinds of setup issues!
- Ask for help: Show this guide to a parent, teacher, or tech-savvy friend
- Double-check each step: Go through this guide again slowly
Remember: Setting up programming tools can be tricky the first time, but once itâs working, youâll be able to create amazing things!
đŻ Ready to start coding? Head to your first worksheet!