|
| 1 | +# TAGLINE |
| 2 | + |
| 3 | +Retro game engine and resource editor for Python |
| 4 | + |
| 5 | +# TLDR |
| 6 | + |
| 7 | +**Run** a game script |
| 8 | + |
| 9 | +```pyxel run [01_hello_pyxel.py]``` |
| 10 | + |
| 11 | +**Rerun** when files in a directory change |
| 12 | + |
| 13 | +```pyxel watch [.] [game.py]``` |
| 14 | + |
| 15 | +**Edit** sprites, tilemaps, and sound (creates the file if missing) |
| 16 | + |
| 17 | +```pyxel edit [my_resource.pyxres]``` |
| 18 | + |
| 19 | +**Package** a directory into a **.pyxapp** |
| 20 | + |
| 21 | +```pyxel package [src] [src/main.py]``` |
| 22 | + |
| 23 | +**Play** a packaged app |
| 24 | + |
| 25 | +```pyxel play [game.pyxapp]``` |
| 26 | + |
| 27 | +Copy the **bundled examples** into **./pyxel_examples** |
| 28 | + |
| 29 | +```pyxel copy_examples``` |
| 30 | + |
| 31 | +# SYNOPSIS |
| 32 | + |
| 33 | +**pyxel** |
| 34 | + |
| 35 | +**pyxel run** _script.py_ |
| 36 | + |
| 37 | +**pyxel watch** _directory_ _script.py_ |
| 38 | + |
| 39 | +**pyxel play** _app.pyxapp_ |
| 40 | + |
| 41 | +**pyxel edit** [_resource.pyxres_] |
| 42 | + |
| 43 | +**pyxel package** _app_dir_ _startup.py_ |
| 44 | + |
| 45 | +**pyxel app2exe** _app.pyxapp_ |
| 46 | + |
| 47 | +**pyxel app2html** _app.pyxapp_ |
| 48 | + |
| 49 | +**pyxel copy_examples** |
| 50 | + |
| 51 | +# PARAMETERS |
| 52 | + |
| 53 | +**run** _script.py_ |
| 54 | +> Run a Python file. A missing **.py** suffix is added. The script's directory is put on **sys.path**. |
| 55 | +
|
| 56 | +**watch** _directory_ _script.py_ |
| 57 | +> Run _script.py_ and restart it when any file under _directory_ changes. Stop with **Ctrl+C** (**Cmd+C** on macOS). The script must live inside _directory_. |
| 58 | +
|
| 59 | +**play** _app.pyxapp_ |
| 60 | +> Unpack and run a Pyxel application file. **.pyxapp** is added when the name has no suffix. A **.zip** path is accepted as-is. |
| 61 | +
|
| 62 | +**edit** [_resource.pyxres_] |
| 63 | +> Open the image, tilemap, sound, and music editors. Omitted name becomes **my_resource.pyxres**. A missing file is created. A missing **.pyxres** suffix is added. |
| 64 | +
|
| 65 | +**package** _app_dir_ _startup.py_ |
| 66 | +> Write _app_dir_**.pyxapp** (a zip) in the current directory. _startup.py_ must be inside _app_dir_. Comment headers in that file (**title**, **author**, **desc**, **site**, **license**, **version**) are stored as zip metadata and printed by **play**. **.gif**, **.zip**, and **__pycache__** are left out. |
| 67 | +
|
| 68 | +**app2exe** _app.pyxapp_ |
| 69 | +> Build a windowed executable with PyInstaller. Fails if PyInstaller is not installed. |
| 70 | +
|
| 71 | +**app2html** _app.pyxapp_ |
| 72 | +> Write _name_**.html** in the current directory. The page loads Pyxel's web runtime and embeds the **.pyxapp**. |
| 73 | +
|
| 74 | +**copy_examples** |
| 75 | +> Replace **./pyxel_examples** with the examples shipped in the package. |
| 76 | +
|
| 77 | +# DESCRIPTION |
| 78 | + |
| 79 | +**pyxel** is the command installed with the Pyxel Python library, a retro game engine with a fixed 16-color palette, four sound channels, image banks, and tilemaps. Games are ordinary Python scripts (**import pyxel**, then **pyxel.init** and **pyxel.run**). The same command opens the bundled resource editor and packs a project for other machines or for the browser. |
| 80 | + |
| 81 | +With no arguments it prints the version and the command list. |
| 82 | + |
| 83 | +While a game or the editor is running: **Esc** quits; **Alt+1** saves a screenshot to the desktop; **Alt+3** saves up to 10 seconds of capture; **Alt+Enter** toggles fullscreen; **Alt+0** toggles the performance monitor. On macOS the **Alt** shortcuts use **Option**. |
| 84 | + |
| 85 | +# CAVEATS |
| 86 | + |
| 87 | +Needs Python 3.11 or newer. The **pyxel** command comes from **pip install pyxel** (or a distro package of that project), not from the Python standard library. Games open a graphical window; this is not a terminal game. **watch** errors if the script is outside the watched directory. **app2exe** depends on PyInstaller and writes build files in the working directory. **app2html** needs network access when the page is opened, because it loads the web runtime from a CDN pinned to the installed Pyxel version. |
| 88 | + |
| 89 | +# INSTALL |
| 90 | + |
| 91 | +```nix: nix profile install nixpkgs#pyxel``` |
| 92 | + |
| 93 | +<!-- packages: 2026-10-02 --> |
| 94 | + |
| 95 | +# SEE ALSO |
| 96 | + |
| 97 | +[python](/man/python)(1), [pygame](/man/pygame)(1), [pip](/man/pip)(1) |
| 98 | + |
| 99 | +# RESOURCES |
| 100 | + |
| 101 | +```[Source code](https://github.com/kitao/pyxel)``` |
| 102 | + |
| 103 | +```[Documentation](https://kitao.github.io/pyxel/web/user-guide/)``` |
| 104 | + |
| 105 | +<!-- verified: 2026-10-02 --> |
0 commit comments