Skip to main content

PYGAMEEASY

pygame without the pain. A window, shapes, images, sound and input in a few readable lines.

pip install pygame-easy

The package is installed as pygame-easy and imported as pygameeasy.

Quick start

import pygameeasy

fps = 60

snakeMusic = pygameeasy.volume("volume.mp3", "music")
snakeClick = pygameeasy.volume("volume2.mp3", "volume")

snake = pygameeasy.ObjectIM(100, 200, "photo.png")
snakeZAD = pygameeasy.Object("circle", 100, 200, "#000000")

wp = pygameeasy.wp(fps)

while True:
    wp.checkforclose()

    snake.render(100, 100)
    snakeZAD.render(100, 100)

    if pygameeasy.check("keyboard", "w"):
        snakeClick.volume(44)

    if pygameeasy.check("mouse", "left"):
        snakeClick.volume(44)

    wp.render()

API

pygameeasy.wp(fps, width=800, height=600, title="PYGAMEEASY", background="#FFFFFF", resizable=False, fullscreen=False)

Creates the window and runs the frame loop.

Member Description
checkforclose() Processes events. Closes the program when the window is closed. Call it first in every frame.
render() Shows the frame, holds the FPS and clears the screen for the next frame. Returns dt in seconds.
dt Duration of the previous frame in seconds, for frame-rate independent movement.
width, height Current window size.
screen The underlying pygame.Surface, for anything not covered by the library.
events Raw pygame events of the current frame.
title(text) Changes the window title.
close() Quits pygame and exits the program.

pygameeasy.Object(shape, sizeX, sizeY, color)

A colored shape. shape is "circle" (an ellipse when sizeX != sizeY), "rect" (aliases "rectangle", "square") or "triangle". color accepts "#RRGGBB" and pygame color names. The color attribute can be changed at any time.

render(x, y, center=False) draws the shape with its top-left corner at x, y, or with its center there when center=True. It returns the pygame.Rect that was drawn.

pygameeasy.ObjectIM(sizeX, sizeY, file)

An image scaled to sizeX × sizeY. Transparency is kept. render(x, y, center=False) works like Object.render.

pygameeasy.volume(file, kind, level=100)

Loads audio. level is 0–100.

kind="music" starts playing immediately and restarts by itself when it ends. .volume(level) changes its loudness. Also available: pause(), resume(), stop(), play(). pygame has a single music stream, so a second "music" object replaces the first.

kind="volume" is a sound effect. .volume(level) sets the loudness and plays the sound; while it is still playing, repeated calls (for example from a held key) only update the loudness and do not stack copies. Also available: play() to force a start, stop(), playing, level.

pygameeasy.check(device, name, once=False)

device="keyboard": any pygame key name ("w", "space", "left", "up", "f1", ...), plus the aliases "esc", "enter", "ctrl", "shift", "alt".

device="mouse": "left", "middle", "right", "scrollup", "scrolldown".

By default it is True for as long as the key or button is held. With once=True it is True only in the single frame where it was pressed (scroll is always per frame).

pygameeasy.mouse_position() returns (x, y).

Development

pip install -e ".[dev]"
pytest
python -m build
twine check dist/*
twine upload dist/*

Tests run headless (SDL_VIDEODRIVER=dummy, SDL_AUDIODRIVER=dummy).

License

MIT

Metadata

Release files for pygameeasysup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygameeasysup 0.1.0
File Size Uploaded Provenance Actions
pygameeasysup-0.1.0.tar.gz 9.9 kB Without provenance Details for pygameeasysup-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygameeasysup 0.1.0
File Interpreter ABI Platform Actions
pygameeasysup-0.1.0-py3-none-any.whl Python 3 none any Details for pygameeasysup-0.1.0-py3-none-any.whl

Total release size: 18.1 kB

Release files / pygameeasysup-0.1.0.tar.gz

Download URL pygameeasysup-0.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2eac96ec3dec2df17856e68188cf6631a6ce98d4f876979b070abdcecfcafb6
BLAKE2b-256 checksum
How to use checksums
18e3bb4319fbce0ee21a4c7c5ff560da26c9538ddc87dc69d6df7879ae192ce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / pygameeasysup-0.1.0-py3-none-any.whl

Download URL pygameeasysup-0.1.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
287482d641c3a55170b5df1f0fbc7b4346712c1c76584e6b8cd2bfd649777121
BLAKE2b-256 checksum
How to use checksums
2397d15fa8e45c95947fdb5c230580883f84f09f535256614fb84d63a4c24fb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Security for pygameeasysup 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page