Run your pyxel applications, reloading when code / assets change
Project description
pyxel-reload
A hot-reloading development tool for Pyxel games that automatically refreshes your game when code or asset files change.
Features
- Hot reloading of Python code changes
- Automatic reloading when .pyxres asset files change
- Error display in both console and game window
- Simple integration with existing Pyxel games
Installation
Install via pip:
pip install pyxel-reload
Usage
- Ensure your game file has an
updateanddrawfunction
import pyxel
pyxel.init(160, 120)
def update():
if pyxel.btnp(pyxel.KEY_Q):
pyxel.quit()
def draw():
pyxel.cls(0)
pyxel.text(10, 10, "Hello, Pyxel!", pyxel.frame_count % 16)
pyxel.run(update, draw)
- Run your game with pyxel-reload:
pyxel-reload game
Where game is the name of your Python module (without the .py extension).
- Make changes to your code or .pyxres files and see them reload automatically!
Error Handling
When errors occur during reload:
- Error details are displayed in the console
- A basic error message appears in the game window
- The game continues running and will reload once errors are fixed
Run code before reload
If you need to run some code before the game is reloaded, you can define a
on_unload function in your game module:
def on_unload():
stop_music()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyxel_reload-0.2.2.tar.gz.
File metadata
- Download URL: pyxel_reload-0.2.2.tar.gz
- Upload date:
- Size: 293.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0798471fb2b7582f58e02b8d686155de8f7fa610db408392508bcb5a87f31abf
|
|
| MD5 |
605c69d798bfde426e855760dade98d5
|
|
| BLAKE2b-256 |
4cae5b1af566aa3f230884ea836b0d40662e4dbd982f387f51a2f910737e87b5
|
File details
Details for the file pyxel_reload-0.2.2-py3-none-any.whl.
File metadata
- Download URL: pyxel_reload-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c98e87bbb8303377ff1ac6aad1dd463635da4b1fdd03bfd8daadc65c1b40d07
|
|
| MD5 |
671034d4904afb61d293c6268ee72f6a
|
|
| BLAKE2b-256 |
6665188ea18fb65018d110b566b37635202238fc41e5c15ba2ece5f0629a093d
|