Skip to main content

Physics module that merges Pymunk with Pyxel.

Project description

Physics engine that merges Pyxel with Pymunk.


Clone repository and use flit install -s to install locally or pip install pyxel-physics, if you do not want to participate in the development of Pyxel Physics.


The folllowing code simulates a gas of spheres. Let us start importing some modules.

from random import uniform

import pyxel
import phys

First, we initialize pyxel and set the gravity in the space object.

pyxel.init(120, 80, fps=60)
space =, 25))

Secondly, let us create some object in the screen. phys.circ produces a Circle body using an API similar to pyxel. Pyxel physics also has functions such as rect, tri, line and poly that behaves similarly.

 radius = 2
 for _ in range(50):
     x, y = uniform(0, 120), uniform(0, 80)
     phys.circ(x, y, radius, vel=(uniform(-25, 25), uniform(-25, 25)))


We can start the main loop using the default pyxel mechanisms, or simply executing the run() method of space objects.

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-physics-0.1.0.tar.gz (5.9 kB view hashes)

Uploaded source

Built Distribution

pyxel_physics-0.1.0-py2.py3-none-any.whl (7.2 kB view hashes)

Uploaded py2 py3

Supported by

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