Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, n_canvases=3, *args, **kwargs):
"""Constructor."""
super(MultiCanvas, self).__init__(*args, _canvases=[Canvas() for _ in range(n_canvases)], **kwargs)
def draw_image(self, image, x=0, y=0, width=None, height=None):
"""Draw an ``image`` on the Canvas at the coordinates (``x``, ``y``) and scale it to (``width``, ``height``)."""
if (not isinstance(image, (Canvas, MultiCanvas, Image))):
raise TypeError('The image argument should be an Image, a Canvas or a MultiCanvas widget')
if width is not None and height is None:
height = width
serialized_image = widget_serialization['to_json'](image, None)
self._send_canvas_command('drawImage', (serialized_image, x, y, width, height))