-
Notifications
You must be signed in to change notification settings - Fork 220
support the ipycanvas widget in cocalc-jupyter #5159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Probably this involves:
|
I'd add that this would provide a very convenient way to incorporate turtle graphics in a notebook for teaching, along with efficient graphics for games and visualizations like 'game of life'. |
!pip install ipycanvas from ipycanvas import Canvas
canvas = Canvas(width=200, height=200)
canvas.fill_rect(25, 25, 100, 100)
canvas.clear_rect(45, 45, 60, 60)
canvas.stroke_rect(50, 50, 50, 50)
canvas |
The basics work, but something else goes wrong with this example from the docs: from ipycanvas import Canvas
canvas = Canvas(width=100, height=50)
def perform_drawings():
canvas.font = "32px serif"
canvas.fill_text("Voilà!", 10, 32)
canvas then in another cell perform_drawings() It works the first time. If you then refresh the browser, it crashes and further evaluation does not work. This is also broken in the same way when used with JupyterLab. This is an upstream bug that has been opened 1.5 years with no comment: jupyter-widgets-contrib/ipycanvas#322 So basically now cocalc matches the jupyterlab behavior, which is the best we can hope for. |
I'm going to close this; it's not our bug and I don't know what to do about it. |
See https://ipycanvas.readthedocs.io/en/latest/
The text was updated successfully, but these errors were encountered: