Code Monkey home page Code Monkey logo


pygfx

CI Documentation Status PyPI version

Pygfx' purpose is to bring powerful and reliable visualization to the Python world. 🚀

Pygfx (pronounced "py-graphics") is built on wgpu, enabling superior performance and reliability compared to OpenGL-based solutions. It is designed for simplicity and versatility: with its modular architecture, you can effortlessly assemble graphical scenes for diverse applications, from scientific visualization to video game rendering.

drawing drawing drawing

[User Guide] [Example Gallery] [API Reference]

Professional support

Need help? We offer the following professional services:

  • Priority Support: Rest assured with our dedicated support, prioritizing your needs for quick issue resolution and feature implementation.
  • Integration Support: Get assistance with integrating pygfx into your application, ensuring a smooth transition and optimal performance.
  • Customized Solutions: Whether it's crafting specific visualizations or developing shaders, we work closely with you to create tailored solutions that address your unique requirements.
  • Training and Workshops: We provide informative training sessions and workshops aimed at boosting skills and knowledge.

Also checkout the sponsors page. For further inquiries reach out to us at [email protected].

Installation

pip install -U pygfx glfw

To work correctly, pygfx needs some window to render to. Glfw is one lightweight option, but there are others, too. If you use a different wgpu-compatible window manager or only render offscreen you may choose to omit glfw. Examples of alternatives include: jupyter_rfb (rendering in Jupyter), PyQt, PySide, or wx.

In addition there are some platform requirements, see the wgpu docs. In essence, you need modern (enough) graphics drivers, and pip>=20.3.

Status

We're currently working towards version 1.0, which means that the API can change with each version. We expect to reach 1.0 near the end of 2024, at which point we start caring about backwards compatibility.

This means that until then, you should probably pin the pygfx version that you're using, and check the release notes when you update.

Usage Example

Note The example below is designed against the main branch, and may not work on the latest release from pypi, while we're in beta.

Note A walkthrough of this example can be found in the guide.

import pygfx as gfx
import pylinalg as la

cube = gfx.Mesh(
    gfx.box_geometry(200, 200, 200),
    gfx.MeshPhongMaterial(color="#336699"),
)

rot = la.quat_from_euler((0, 0.01), order="XY")

def animate():
    cube.local.rotation = la.quat_mul(rot, cube.local.rotation)

if __name__ == "__main__":
    gfx.show(cube, before_render=animate)

drawing

Feature Highlights

Some of pygfx's key features are:

  • SDF based text rendering (example)
  • order-independent transparency (OIT) (example)
  • lights, shadows, and physically based rendering (PBR) (example)
  • event system with built-in picking (example)
  • texture and color mapping supporting 1D, 2D and 3D data (example)

And many more! Check out our feature demos in the docs.

License

Pygfx is licensed under the BSD 2-Clause "Simplified" License. This means:

  • ✅ It is free (and open source) forever. 💘
  • ✅ You can use it commercially.
  • ✅ You can distribute it and freely make changes.
  • ❌ You can not hold us accountable for the results of using pygfx.

Contributing

See CONTRIBUTING.md.

Development Install

To get a working dev install of pygfx you can use the following steps:

# Click the Fork button on GitHub and navigate to your fork
git clone <address_of_your_fork>
cd pygfx
# if you use a venv, create and activate it
pip install -e ".[dev,docs,examples]"
pytest tests

Testing

The test suite is divided into two parts; unit tests for the core, and unit tests for the examples.

  • pytest -v tests runs the core unit tests.
  • pytest -v examples tests the examples.

Code of Conduct

Our code of conduct can be found here: Code of Conduct

pygfx's Projects

noto-mirror icon noto-mirror

Mirror a selection of Noto fonts to support full Unicode support in PyGfx

pga3 icon pga3

Proper Geometry Algorithms in 3D

pygfx icon pygfx

Powerful and versatile visualization for Python.

wgpu-py icon wgpu-py

The next generation GPU API for Python

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.