Open rhuygen opened 2 months ago
I created a simple class that extends from ImageViewer and when I update this loading a new Image, the widget is not redrawn.
ImageViewer
class ImageWidget(ImageViewer): def __init__(self, image: Image.Image | None, id=None): if image is None: image = Image.new('L', (2295, 4540), 0) super().__init__(image) self.id = id def update(self, image: Image.Image): self.image = ImageView(image) self.refresh()
The solution that I found is to set the container coordinates and use on_show() instead of refresh():
on_show()
refresh()
class ImageWidget(ImageViewer): def __init__(self, image: Image.Image | None, id=None): if image is None: image = Image.new('L', (2295, 4540), 0) super().__init__(image) self.id = id def update(self, image: Image.Image): self.image = ImageView(image) self.image.set_container_size(*self.container_size) self.on_show()
I created a simple class that extends from
ImageViewer
and when I update this loading a new Image, the widget is not redrawn.The solution that I found is to set the container coordinates and use
on_show()
instead ofrefresh()
: