Learning to Code

Circuitry is a full code editor of the kind professionals use, and it is also a place to learn. You write a program on one side and see what it does on the other: a turtle drawing a square, a game, a maths animation, a table and a chart, a web page. Press Run, change a number, press Run again.

Python runs on the device you are holding, so there is nothing to install before the first lesson. The same lessons work in a web browser, in the desktop app, and on an iPad or a phone.

This section is a set of short paths. Each one has a first program to type or paste, what you should see, three things to try changing, and where to go next.

Pick a path

You areStart with
A child, or anyone writing a first programFirst steps: drawing with turtle
At school or college, and you want to make pictures and gamesGraphics and games with Pyctures
Studying maths, or explaining it to someoneMaths animations with Pymations
A university student or a scientist with data to look atData and science
Learning how web sites are madeBuilding for the web
Already a programmer, and used to an editor such as VS CodeHow the editor helps you learn
A teacher planning lessonsFor teachers

The paths are in order of difficulty, but none depends on the one before it. If you do not know where to start, start with turtle.

The paths

  1. First steps: drawing with turtle. Turtle is a simple way of programming, used in schools to teach children how to make simple programs. You tell a turtle to move and to turn, and it draws a line wherever it goes. It is Python's own turtle module, so exercises from a book or a worksheet run as they are written.
  2. Graphics and games with Pyctures. A few plain functions (circle, rect, text) and a draw() that is called every frame. Moving shapes, the keyboard and the mouse, sprites, sound and 3D.
  3. Maths animations with Pymations. Shapes, equations and graphs that appear, move and change into each other, the way they do in maths explainer videos. Scripts written for Manim run too.
  4. Data and science. pandas tables, charts, exact algebra with sympy, and fitting and statistics with scipy and scikit-learn. One file with its output beside it, or a notebook of cells in a CodeBook.
  5. Building for the web. A Python web server written with Flask, with the page it serves shown beside the code. HTML and React files have a live preview of their own.
  6. How the editor helps you learn. Run, the preview, the three views, the output panel, breakpoints, where files are kept, working on an iPad or a phone, and what an AI agent can do alongside you.
  7. For teachers. What runs on the device and what needs a connection or a computer, how to hand out starter files, and what students can install.

Before the first lesson

  1. Open Circuitry in a web browser, or install the app. See Installation.
  2. From the new-document menu, choose Code, then Python, and give the file a name ending in .py.
  3. Type or paste a program and press Run in the footer.

The first run in a session loads Python, which can take a few seconds. After that, runs start straight away.

Coming from pygame

There is no pygame in Circuitry, so a file that imports pygame does not run in the preview. Use Pyctures for the same kind of program: it has a function that is called every frame, the keyboard and the mouse, sprites and sound.