-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf9192a
commit 16e5079
Showing
39 changed files
with
1,906 additions
and
1,055 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Cube asyncio | ||
------------ | ||
Run a wgpu example on the glfw backend, and the asyncio loop | ||
""" | ||
|
||
import asyncio | ||
|
||
from rendercanvas.glfw import RenderCanvas | ||
from rendercanvas.asyncio import loop | ||
from rendercanvas.utils.cube import setup_drawing_sync | ||
|
||
|
||
# The asyncio loop is the default, but this may change, so better be explicit. | ||
RenderCanvas.select_loop(loop) | ||
|
||
canvas = RenderCanvas( | ||
title="The wgpu cube on $backend with $loop", update_mode="continuous" | ||
) | ||
draw_frame = setup_drawing_sync(canvas) | ||
canvas.request_draw(draw_frame) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
async def main(): | ||
# ... add asyncio stuff here | ||
await loop.run_async() | ||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Cube qt canvas on the trio loop | ||
------------------------------- | ||
Run a wgpu example on the Qt backend, but with the trio loop. | ||
Not sure why you'd want this, but it works! Note that the other way | ||
around, e.g. runnning a glfw canvas with the Qt loop does not work so | ||
well. | ||
""" | ||
|
||
# ruff: noqa: E402 | ||
|
||
import trio | ||
from rendercanvas.pyside6 import RenderCanvas | ||
from rendercanvas.trio import loop | ||
from rendercanvas.utils.cube import setup_drawing_sync | ||
|
||
RenderCanvas.select_loop(loop) | ||
|
||
canvas = RenderCanvas(title="The $backend with $loop", update_mode="continuous") | ||
draw_frame = setup_drawing_sync(canvas) | ||
canvas.request_draw(draw_frame) | ||
|
||
|
||
if __name__ == "__main__": | ||
trio.run(loop.run_async) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Cube trio | ||
--------- | ||
Run a wgpu example on the glfw backend, and the trio loop | ||
""" | ||
|
||
import trio | ||
from rendercanvas.glfw import RenderCanvas | ||
from rendercanvas.trio import loop | ||
from rendercanvas.utils.cube import setup_drawing_sync | ||
|
||
|
||
RenderCanvas.select_loop(loop) | ||
|
||
canvas = RenderCanvas( | ||
title="The wgpu cube on $backend with $loop", update_mode="continuous" | ||
) | ||
draw_frame = setup_drawing_sync(canvas) | ||
canvas.request_draw(draw_frame) | ||
|
||
|
||
if __name__ == "__main__": | ||
# This works, but is not very trio-ish | ||
# loop.run() | ||
|
||
# This looks more like it | ||
# trio.run(loop.run_async) | ||
|
||
# But for the sake of completeness ... | ||
|
||
async def main(): | ||
# ... add Trio stuff here | ||
await loop.run_async() | ||
|
||
trio.run(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.