MultiCanvas with a mix of Canvas and RoughCanvas layers #144
Replies: 2 comments 7 replies
-
Hi - I'm loving ipycanvas. It's enabled me to create animations for a medium article\jupyter notebook I'm currently writing on Reinforcement Learning. |
Beta Was this translation helpful? Give feedback.
-
Hi! Thanks for asking your question here :) First time I use this discussion thingy, are you able to open a discussion in the Q&A section? I wonder if everyone has the right to do that, it would be nice. Very interesting use-case, I haven't thought of that. It seems that the public API does not allow this, but I should be able to easily change this for the next release. from traitlets import List, Instance
from ipywidgets import widget_serialization
from ipycanvas import MultiCanvas, Canvas
class CustomMultiCanvas(MultiCanvas):
_canvases = List(Instance(Canvas)).tag(sync=True, **widget_serialization)
def __init__(self, canvases=[], *args, **kwargs):
super(MultiCanvas, self).__init__(*args, _canvases=canvases, **kwargs) Then you should be able to create it by passing your canvases to the constructor: multi = CustomMultiCanvas((Canvas(), RoughCanvas(), Canvas())) Disclaimer: I haven't tested it, but I suppose that would work
Yep, that works too. Just note that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👇🏼
Beta Was this translation helpful? Give feedback.
All reactions