Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

CI Documentation Status PyPI version EffVer Versioning Zenodo badge


rendercanvas

One canvas API, multiple backends 🚀

This project is part of pygfx.org

Introduction

See how the two windows above look the same? That's the idea; they also look the same to the code that renders to them. Yet, the GUI systems are very different (Qt vs glfw in this case). Now that's a powerful abstraction!

Purpose

Providing a generic API for:

  • managing a canvas window (BaseRenderCanvas).
  • presenting rendered results with wgpu (WgpuContext).
  • presenting rendered results as a bitmap (BitmapContext).
  • working with events that have standardized behavior.

The following backends are currently available:

  • auto - automatically selects an appropriate backend.
  • glfw - a native desktop window.
  • offscreen - for offscreen rendering.
  • terminal - to render in the terminal (e.g. over SSH).
  • qt (pyside6 / pyside2 / pyqt6 / pyqt5) - to embed a render canvas in a qt GUI.
  • wx - to embed a render canvas in a wx GUI.
  • anywidget - for notebooks like Jupyter, VSCode, and Marimo.
  • jupyter - previous backend for notebooks that uses jupyter_rfb.
  • http - for server side rendering, display in a browser connected via the internet.
  • pyodide - to run in the browser with Pyodide or PyScript.

In addition to the GUI libraries mentioned above, the following event loops are supported:

  • asyncio
  • trio
  • raw

Installation

pip install rendercanvas

To have at least one backend, we recommend:

pip install rendercanvas glfw

Usage

Also see the online documentation and the examples.

A minimal example that renders noise:

import numpy as np
from rendercanvas.auto import RenderCanvas, loop

canvas = RenderCanvas(update_mode="continuous")
context = canvas.get_bitmap_context()


@canvas.request_draw
def animate():
    w, h = canvas.get_logical_size()
    bitmap = np.random.uniform(0, 255, (h, w)).astype(np.uint8)
    context.set_bitmap(bitmap)


loop.run()

Run wgpu visualizations:

from rendercanvas.auto import RenderCanvas, loop
from rendercanvas.utils.cube import setup_drawing_sync


canvas = RenderCanvas(
    title="The wgpu cube example on $backend", update_mode="continuous"
)
draw_frame = setup_drawing_sync(canvas)
canvas.request_draw(draw_frame)

loop.run()

Embed in a Qt application:

from PySide6 import QtWidgets
from rendercanvas.qt import QRenderWidget


class Main(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()

        splitter = QtWidgets.QSplitter()
        self.canvas = QRenderWidget(splitter)
        ...


app = QtWidgets.QApplication([])
main = Main()
app.exec()

Async or not async

We support both; a render canvas can be used in a fully async setting using e.g. Asyncio or Trio, or in an event-driven framework like Qt. If you like callbacks, loop.call_later() always works. If you like async, use loop.add_task(). See the docs on async for details.

License

This code is distributed under the 2-clause BSD license.

Contributing

See the contribution guide.

Development install

  • Clone the repo.
  • Install rendercanvas and developer deps using pip install -e .[dev].

Quick tips

  • Use ruff format to apply autoformatting.
  • Use ruff check to check for linting errors.
  • Use pytest tests to run the tests.
  • Use pytest examples to run a subset of the examples.
  • Use pytest tests/test_backend_xx.py to run backend-specific tests, e.g. for glfw, qt, wx.

Code of Conduct

This repository follows the PyGfx Code of Conduct

Metadata

Release files for rendercanvas 3.0.1

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for rendercanvas 3.0.1
File Size Uploaded Provenance Actions
rendercanvas-3.0.1.tar.gz 122.9 kB With provenance Details for rendercanvas-3.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 266.0 kB

Release files / rendercanvas-3.0.1.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL rendercanvas-3.0.1.tar.gz
Size 122.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3fe0d47edb3a8353f01b77edf1dcfd8fb55379efb77e3bff51c9111d14d6c301
BLAKE2b-256 checksum
How to use checksums
e1616c799e0b2e213523123e067a1c667c5a40e1c0eb7e919fc9c8e5e3b78161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / rendercanvas-3.0.1-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL rendercanvas-3.0.1-py3-none-any.whl
Size 143.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b574258ebe54e120304ba20702fee6d825a9ad701afa0c247b367d988d8cb40b
BLAKE2b-256 checksum
How to use checksums
b7c9809e3c95a16597395a32e3efad3221d77fa36106473b290a95aa1f0306d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for rendercanvas 3.0.1

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.

Change of provenance

The configuration that created this release differs from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for rendercanvas-3.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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.

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