Using Basthon-Console
Finding your way around the interface

The editor, where you write your script, is on the left; the console, where it runs, is on the right. The button at the bottom right leads to this documentation.
Info
Some users expect a window to open with the graphical output (for Turtle or Matplotlib for instance). It does not. Show it with the button (which blinks when a new drawing is available), or show the console and the graphical output together with the
button.
Astuce
It can be handy to enlarge or reduce the font of the editor and of the console. Use Ctrl+wheel or Ctrl++.
Astuce
The dark mode (the default) is soothing for the eyes but does not suit a video projector, since it has little contrast. Switch to the light mode with the button.
Info
The appearance you chose (theme, layout of the panels) and the content of the editor are kept by your browser: you find Basthon in the state you left it in.
Using the editor
The editor has syntax highlighting and completion. It is used as usual, with many shortcuts. In particular, Ctrl+Z undoes an action, Ctrl+A selects the whole content, Ctrl+F searches, Ctrl+, changes the settings of the editor and Ctrl+S downloads the script. The functions and variables declared in the editor are available in the console, and conversely.
Using the console
The console is used like the usual Python interpreter (or that of the chosen language, see Other languages). The Enter key runs a statement. An incomplete statement (after def f(): or for i in range(3): for instance) goes on to the next line, marked with ...: an empty line ends it and runs it. The functions and variables declared in the editor are available in the console, and conversely.
| Keys | Action |
|---|---|
| ↑ / ↓ | browse the history of statements |
| Tab | complete the current name (or indent at the start of a line) |
| Ctrl+A / Ctrl+E | go to the start / the end of the line (as Home / End) |
| Ctrl+← / Ctrl+→ | go to the previous / next word |
| Ctrl+U / Ctrl+K | erase up to the start / up to the end of the line |
| Ctrl+W | erase the previous word |
| Ctrl+C | copy the selection or, with no selection, drop the current line |
Astuce
A program that runs too long (an infinite loop for instance) can be stopped by restarting the kernel with the button.
Saving and opening a script
To save the content of the editor into a *.py file, use the button (or Ctrl+S).
To load the content of a *.py file into the editor, use the button and choose "Charger dans l'éditeur" (load into the editor). This button also loads extra resources such as text files, images or even Python modules: see the sections Using extra files and Importing your own module.
Going back to a previous version
Basthon keeps the last versions of your script (at each run and when the page is closed). The button lets you pick one of them, by its date, to load it back into the editor.
Astuce
If the page was closed while a program was running (an infinite loop for instance), Basthon notices it at the next load and offers to choose the backup to resume from.
Sharing a script and using files
The share button creates a link that holds the script. To share a script put on the web, with its extra files and modules, see Sharing an activity and its link generator.
The open button also loads extra files (images, data…) and modules: see Extra files and modules.
