Skip to content

A fully-featured Python creative-coding framework built on top of PyGame, designed for artists, educators, and rapid prototyping. Think Processing/openFrameworks ergonomics with Python simplicity and PyGame performance.

License

Notifications You must be signed in to change notification settings

PeteHaughie/PyCreative

Repository files navigation

PyCreative

CI

PyCreative is a batteries-included creative-coding framework that makes it trivial to build visual, audio, and interactive projects in Python while staying lightweight and extensible. It uses Pyglet for low-level drawing, input, and window/context management, but provides higher-level conveniences: a component-driven app loop, scene & state management, easy shader support, multimedia I/O, asset management, utilities for math & noise, tight integration for live-coding, and idiomatic Python APIs inspired by Processing and openFrameworks.

Features

  • Modular architecture for easy extension
  • 2D/3D graphics, OpenGL, audio, video, MIDI, user input
  • Simple, discoverable, and chainable APIs

Examples

The examples/ directory includes runnable sketches that demonstrate the APIs.

Run examples with the CLI:

pycreative examples/sketch_example.py

For more in-depth docs, see docs/README.md and the module-level docs under src/pycreative/.

Why?

The reasoning behind building PyCreative was threefold: First, I had a problem to solve ie the need to have a lightweight fast portable framework for building interactive media devices, secondly as a method of learning GitHub's Spec Kit to see how AI assisted development works, and thirdly to see how large-scale python applications were made (although it's probably not a good example of that).

Processing and openFrameworks are both fantastic tools for creative coding—so why make another framework with a similar API? The short answer: portability and extensibility.

Processing is lightweight and fast to launch, but it isn’t well-suited for building hardware-driven projects like video synths. openFrameworks, on the other hand, is powerful and close to the metal, but it relies on complex toolchains (CMake, Make) or heavy IDEs (Xcode, Visual Studio) along with C++ addons, which can be a barrier for rapid experimentation.

After years of building projects with both frameworks, I wanted a middle ground: something with Processing’s simplicity, openFrameworks’ hardware potential, and Python’s flexibility. Pyglet provides a fast, battle-tested engine for moving pixels around, but its quirks (like blitting) make it cumbersome for quick creative prototyping.

PyCreative hides those complexities behind a Processing-style API, while leveraging Python’s huge ecosystem. It runs out of the box on macOS, Windows, Linux, and even low-power devices like the Raspberry Pi—no complicated toolchain required. Add MIDI, OSC, GPIO, or whatever else you need through Python’s libraries, and you’ve got a powerful, extensible framework for creative coding and rapid prototyping.

More information is in the docs/README.md

Directory Structure

TODOs / Roadmap

  • Custom fonts
  • Audio input/output
  • Video input/output
  • OSC support
  • MIDI input/output
  • 3D graphics
  • Shader support

Future work / deferred research

  • GPU math offload (deferred): PyCreative is a GPU-first application and we should evaluate offloading heavy math workloads (vector ops, neighbor searches, image-wide kernels) to the GPU. Possible approaches include Skia/GrShader compute, Metal/OpenGL compute shaders, or array-based libraries such as CuPy / PyOpenCL with a CPU fallback. This is a non-trivial integration with portability and dependency trade-offs; it is currently deferred until core features are complete. See TODOs or the project task list for more details if you want to prototype this.
  • Implpement fullscreen() restore previous window geometry (deferred): Currently, when exiting fullscreen mode, the window does not restore to its previous size and position. Implementing this feature would improve user experience. Deferred until core features are complete.

Local pre-commit hook

To help maintain package export conventions, a small installer is provided to add a local git pre-commit hook that checks for explicit __init__.py packages under src/core/:

./scripts/install_package_hook.sh

More usage and troubleshooting is in scripts/README.md.

License

MIT

About

A fully-featured Python creative-coding framework built on top of PyGame, designed for artists, educators, and rapid prototyping. Think Processing/openFrameworks ergonomics with Python simplicity and PyGame performance.

Topics

Resources

License

Contributing

Stars

Watchers

Forks