Skip to main content

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

  1. Ensure your game file has an update and draw function
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)
  1. Run your game with pyxel-reload:
pyxel-reload game

Where game is the name of your Python module (without the .py extension).

  1. 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

pyxel_reload-0.2.2.tar.gz (293.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyxel_reload-0.2.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for pyxel_reload-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0798471fb2b7582f58e02b8d686155de8f7fa610db408392508bcb5a87f31abf
MD5 605c69d798bfde426e855760dade98d5
BLAKE2b-256 4cae5b1af566aa3f230884ea836b0d40662e4dbd982f387f51a2f910737e87b5

See more details on using hashes here.

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

Hashes for pyxel_reload-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c98e87bbb8303377ff1ac6aad1dd463635da4b1fdd03bfd8daadc65c1b40d07
MD5 671034d4904afb61d293c6268ee72f6a
BLAKE2b-256 6665188ea18fb65018d110b566b37635202238fc41e5c15ba2ece5f0629a093d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page