Add terminal backend#216
Conversation
| | ``loop`` (an ``AsyncioLoop``) | ||
| - | Backend when Python is running in the browser, | ||
| | via Pyodide or PyScript. | ||
| * - ``terminal`` |
There was a problem hiding this comment.
If you add a subsection further down it would also show up in the sidebar and the main page.
Vipitis
left a comment
There was a problem hiding this comment.
First of all this is awesome! I did quickly look at the diff and also tried it with some pygfx and fpl examples. It worked better than expected.
Via ssh the performance was quite poor, but this could have all kinds of reasons.
All of the bitmap examples (drag, noise, snake) had issues but I think that is due to their hardcoded resolution.
As a dream in the future: if pygfx and fpl render the graphics and gui layer as two different canvas (maybe also for streaming the gui not as pixels, so it could be run the the frontend?) - maybe the gui (and other text) could be rendered as ascii text in the terminal isntead of pixels

And finally, would it make sense to add a small table to the readme. Something like a compatibility matrix to highlight the various backends supported now and what differences might be?
Co-authored-by: Jan <Vipitis@users.noreply.github.com>
Time to address #125; either support some kind of rescaling in the terminal backend, or require the array to match the physical size. |
| term_stream.write(term.move_xy(0, y // 2) + line) | ||
| # Show close button on the first line. Do here rather then at end to avoid flicker. | ||
| if y == 0: | ||
| s = f"ratio {self._pixel_ratio:0.4g} -+ ×" # noqa: RUF001 | ||
| term_stream.write( | ||
| term.normal + term.move_xy(img.shape[1] - len(s), 0) + s | ||
| ) |
There was a problem hiding this comment.
This was really fun to play with. it would be great to have an option to disable this debug line.
I was kinda zooming out to the an ungodly small font size and I didn't even know this existed!
Closes #207
I'm presenting rendercanvas at Euroscipy in a few weeks, and a terminal backend would be a lovely surprise during a live demo.
AI disclaimer: I used Claude as lazy way to get the
blessedcalls I need. But I cleaned them up and made them more efficient in most cases.