Skip to content

Commit 0777212

Browse files
Merge branch 'master' of github.com:fork-tongue/collagraph into hot-reloading
2 parents 5ce1c5a + 0e345de commit 0777212

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

examples/pygfx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ uv run python examples/pygfx/combined-example.py
3131
```
3232
Shows how to integrate a canvas drawn with Pygfx renderer into a PySide app.
3333

34-
The `PySideRenderer` in `combined-example.py` registers the `WgpuCanvas` class so that the renderer knows which class to create for a `<wgpucanvas />` element.
34+
The `PySideRenderer` in `combined-example.py` registers the `RenderCanvas` class so that the renderer knows which class to create for a `<render-canvas />` element.
3535
The `render_widget.cgx` component instantiates a `PygfxRenderer` that renders the point cloud example into a `Scene` object. Note that the amount of points can now be adjusted with the buttons in PySide.

examples/pygfx/button.cgx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<script>
1212
import pygfx as gfx
13-
from wgpu.gui.auto import call_later
13+
from rendercanvas.auto import loop
1414

1515
import collagraph as cg
1616

@@ -39,7 +39,7 @@ class Button(cg.Component):
3939

4040
def pad_pressed(self, event):
4141
self.state["pressed"] = True
42-
call_later(2, self.release)
42+
loop.call_later(2, self.release)
4343

4444
def release(self):
4545
self.state["pressed"] = False

examples/pygfx/component-example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import pygfx as gfx
2-
from wgpu.gui.auto import WgpuCanvas, run
2+
from rendercanvas.auto import RenderCanvas, loop
33

44
import collagraph as cg
55
from examples.pygfx.numberpad import NumberPad
66

77
if __name__ == "__main__":
8-
canvas = WgpuCanvas(size=(600, 400))
8+
canvas = RenderCanvas(size=(600, 400))
99
renderer = gfx.renderers.WgpuRenderer(canvas)
1010

1111
camera = gfx.PerspectiveCamera(60, 16 / 9)
@@ -29,4 +29,4 @@ def animate():
2929
gui = cg.Collagraph(renderer=cg.PygfxRenderer())
3030
gui.renderer.add_on_change_handler(lambda: canvas.request_draw(animate))
3131
gui.render(NumberPad, container)
32-
run()
32+
loop.run()

examples/pygfx/render_widget.cgx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import collagraph as cg
1313

1414
class RenderWidget(cg.Component):
1515
"""
16-
RenderWidget that shows how to host a wgpu canvas object and
16+
RenderWidget that shows how to host a rendercanvas and
1717
use another collagraph instance to render a 3D scene with Pygfx.
1818

19-
Note that the wgpu-canvas element needs to be registered
19+
Note that the render-canvas element needs to be registered
2020
with the root collagraph renderer, like this:
21-
renderer.register_element("WgpuCanvas", WgpuCanvas)
21+
renderer.register_element("RenderCanvas", RenderCanvas)
2222
"""
2323

2424
def mounted(self):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ collagraph = "collagraph.__main__:run"
2020
hook-dirs = "collagraph.__pyinstaller:get_hook_dirs"
2121

2222
[project.optional-dependencies]
23-
pygfx = ["pygfx>=0.9.0"]
23+
pygfx = ["pygfx>=0.13.0"]
2424
pyside = ["PySide6>=6.6.2,!=6.8.3,!=6.9.0 ; python_version < '3.15'"]
2525

2626
[dependency-groups]

0 commit comments

Comments
 (0)