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.1.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.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pyxel_reload-0.2.1.tar.gz.

File metadata

  • Download URL: pyxel_reload-0.2.1.tar.gz
  • Upload date:
  • Size: 293.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for pyxel_reload-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a676638c7dec487ac41629a97b20e6e40431a7645b818f1237efeebd64496275
MD5 3912be937e7066ae28131762ca30d164
BLAKE2b-256 736ea63dc2bbaa1c1bf4959c45aa85c32334ae2b58675573b5ef11dcbd15c1f1

See more details on using hashes here.

File details

Details for the file pyxel_reload-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyxel_reload-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for pyxel_reload-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8bdcd540ffedb29cc913d928b99823ba8be3961b1cbdf96af55f4bf2c592a99
MD5 67e7a46fa7215401ae75e079c3f1fc45
BLAKE2b-256 240336c7246b196aeaba2ebaa420421fe3b688eaa3366d82c9d4f4f6e4555d72

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