Docs · Guide

Guides

PyWebLib has two show-stopper libraries that bring real desktop Python to the browser: turtle for drawing and game for making games. Here is a quick look at each, then a full hands-on guide you can follow in the Playground. For the one-line reference of every call, see the Docs.

A rainbow spiral drawn with turtle

Turtle drawing

A little pen that walks around a window, drawing a line behind it. Tell it to go forward, turn, and change colour, and a few lines in a loop become squares, stars, flowers and rainbow spirals. The gentlest way into loops and coordinates.

import turtle · forward, left, pencolor, circle, begin_fill

A chicken sprite walked around a game window

Games

Sprites, the keyboard, the mouse, collisions and a score, all running smoothly on a canvas with no install. Make a catch game, a dodge game, a maze or a top-down mover, none of the ~1 fps lag real pygame suffers in a browser.

import game · window, sprite, pressed, touches, frame

New to Python? The Docs page is a searchable cheat sheet for the basics too: variables, strings, lists, loops and the random and math libraries, each with a tiny example.