Pencilbox

Pencilbox Code

A free code editor for beginners. It runs JavaScript and web pages with no internet, explains common errors in plain words, and checks work against a teacher’s tests. Python needs a separate download (below). Use either file on this page, or download it for use with no internet.

Trying it on this site needs internet and keeps a recovery copy in this browser. Use File → Save inside the app to keep a file you can move or hand in. Download the HTML file for offline use.

90-second walkthrough of all eight apps

Download and use safely

Follow every step when you put pencilbox-code.html on a shared drive, cart, or USB stick:

  1. Get the whole file. Use the Download button and wait until the browser finishes. Then check the version and byte size under “Check your download” below. Do not use a half-finished or renamed copy.
  2. Open the saved file, not this website. Double-click the downloaded file, or open it from the Files app on a Chromebook. “Try online” on this page still uses schoolhouse.space and needs internet. Email previews and cloud “view in browser” are not the offline app.
  3. Teacher locks are not hard security. Test mode, draft history, playback, and locks help teachers see process. A determined student can edit a file. Do not treat Pencilbox as MDM lockdown or proof of who did the work.

Python

Python runs in Pencilbox Code for Python, a separate file with the same editor plus MicroPython 1.29.0, a small version of Python. It is larger, and it needs a current version of Chrome, Edge, Firefox or Safari, including on Chromebooks.

MicroPython is used under the MIT licence. The full licence text is in the file, under Help.

Use it with no internet

  1. Download the file.
  2. Open it: double-click it, or drag it into a browser window. On a Chromebook, open the Files app and click it.
  3. Keep it wherever is handy, such as a shared drive or a USB stick. It works the same with no connection.

Programs run in a sealed-off frame that can’t reach the internet or the rest of the computer. Save one file at a time, or save every open file together as a .pbproj project.

For teachers: Check

Give students a starter file and a tests file, or both in one .pbproj project. Name the tests file tests.js or tests.py.

  • JavaScript: one check(name, actual, expected) per line, for example check("adds", add(2, 3), 5);
  • Python: one assert per line, for example assert add(2, 3) == 5, "adds"

Students press Check. Code lists each test as passed or failed, with the value it got and the value it expected, and jumps to the line of a failing test.

Check is a practice tool, not proof. The tests file sits next to the student’s code, so a student can read or change it.

Error hints

When a program stops with an error, Code shows the message, marks the line, and for the 25 most common beginner errors in each language adds a hint in plain words, such as a missing colon or a name that was never created. Other errors show the message as it is.

Check your download

pencilbox-code.html: version 1.0.1, 169,346 bytes. SHA-256:

a9e64b1b07293fd34acae72c2f0a1ff42c3e1928543d4a61e643b789c9827da2

pencilbox-code-python.html: version 1.0.1, 887,518 bytes. SHA-256:

bbc16665e97ca24b82f930268367d7d7f695b6b9ec4f2b9621a58d1b522ee05a

To compare on Windows: certutil -hashfile pencilbox-code.html SHA256. On a Mac: shasum -a 256 pencilbox-code.html. On a Chromebook (or if you skip the hash), confirm the version and byte size match this page after the download finishes.

Pencilbox Code: free offline code editor · Schoolhouse