Python autocomplete online: Pygame suggestions as you type
Open a Python file in Striqr and start typing: the editor suggests names, shows a function's parameters as you call it, and says what a name is when you point at it.
For Python autocomplete online, Striqr's editor uses Pyright, the engine behind VS Code's Python support. It runs in your browser tab, on your own device, and starts as soon as a Python file opens, so it's ready by your first key.
It knows pygame as well as Python itself. Here's how it looks in a fresh Pygame project, and what it does and doesn't know.
An online Python editor with autocomplete, step by step
1. Start a Pygame project
On your dashboard, press New project and choose Pygame game. The menu also offers Blank project, Python and Website.
2. Open main.py
The project opens in the editor with main.py. It already holds a small Pygame program, a square you move with the arrow keys, and the preview sits beside your code.
3. Type pygame and a dot
On a new line, type pygame. and a list of pygame's names appears, each marked with what it is, such as a module or a function. The first, Clock, is described beside the list.
Up and Down move through the list, Enter or Tab puts the name in, and Esc closes it. The list opens by itself after a letter or a dot, and Ctrl+Space opens it whenever you want it.
4. Call a function to see its parameters
Carry on so the line reads pygame.draw.circle(. Once you type the opening bracket, a box above the line lists its parameters: surface, color, center, radius and width. The one you're typing is in bold, and the box moves on to the next one at each comma.
5. Find your own names
Delete that line and type clo. The starter program has its own variable called clock, and it comes first, marked as a variable. Your file's own names always come before Python's built-in ones.
We think this is the bit you'll use most once your game grows and you can't remember what you called something.
6. Point at a name to see what it is
Rest the pointer on a name for half a second. We used screen, and a small box reads (variable) screen: Surface. Pyright worked that out from screen = pygame.display.set_mode(...), which is also why typing screen. lists a Surface's methods, such as fill.
What pygame autocomplete knows
It knows Python's standard library and pygame-ce 2.5.7, the version Pygame games run on in the browser. Other packages get nothing: import numpy gives no suggestions.
It knows the open file and every Python file you've opened since the page loaded. Open helpers.py once, and then import helpers followed by helpers. lists its functions. A file you haven't opened yet isn't known.
There's no list inside a comment or a string. It never adds an import for you, and it doesn't check your code for errors.
Who gets suggestions
Everyone who can edit a project gets them, on a computer or a tablet. Someone who's only looking at your project gets what a name is when they point at it, but no list.
Suggestions are off on phones, where a list over the keyboard gets in the way. The editor has its own phone layout, so you can still open and edit your project there.
There's more on the online code editor page. To start a game straight away, try the Pygame online compiler. We also wrote up the release in Python autocomplete in Striqr, plus editor themes.