diff --git a/core/src/stdlib/pyscript/web.py b/core/src/stdlib/pyscript/web.py index 3cafa8ceb9a..f433211d13a 100644 --- a/core/src/stdlib/pyscript/web.py +++ b/core/src/stdlib/pyscript/web.py @@ -1199,7 +1199,7 @@ def download(self, filename="snapped.png"): self.append(download_link) download_link._dom_element.click() - def draw(self, what, width=None, height=None): + def draw(self, what, width=None, height=None, x=0, y=0): """ Draw a 2d image source (`what`) onto the canvas. Optionally scale to `width` and `height`. @@ -1213,9 +1213,9 @@ def draw(self, what, width=None, height=None): ctx = self._dom_element.getContext("2d") if width or height: - ctx.drawImage(what, 0, 0, width, height) + ctx.drawImage(what, x, y, width, height) else: - ctx.drawImage(what, 0, 0) + ctx.drawImage(what, x, y) class video(ContainerElement):