Browse Source

more documentation for interactive_image

Rodja Trappe 2 years ago
parent
commit
9b67f33d4a

+ 5 - 0
nicegui/elements/interactive_image.py

@@ -17,8 +17,13 @@ class InteractiveImage(SourceElement, ContentElement):
         """Interactive Image
 
         Create an image with an SVG overlay that handles mouse events and yields image coordinates.
+        It's also the best choice for non-flickering image updates.
+        If the url changes of source faster than images can be loaded by the browser, some images are simply skipped.
+        Thereby a stream of images automatically adapts to the available bandwidth.
+        See `OpenCV Webcam <https://github.com/zauberzeug/nicegui/tree/main/examples/opencv_webcam>`_ for an example.
 
         :param source: the source of the image; can be an URL or a base64 string
+        :param content: svg content which should be overlayed; viewport has the same dimensions as the image
         :param on_mouse: callback for mouse events (yields `type`, `image_x` and `image_y`)
         :param events: list of JavaScript events to subscribe to (default: `['click']`)
         :param cross: whether to show crosshairs (default: `False`)

+ 1 - 0
nicegui/elements/mixins/content_element.py

@@ -26,6 +26,7 @@ class ContentElement(Element):
         return self
 
     def set_content(self, content: str) -> None:
+        '''changes the content'''
         self.content = content
 
     def on_content_change(self, content: str) -> None:

+ 1 - 0
nicegui/elements/mixins/source_element.py

@@ -26,6 +26,7 @@ class SourceElement(Element):
         return self
 
     def set_source(self, source: str) -> None:
+        '''changes the image source'''
         self.source = source
 
     def on_source_change(self, source: str) -> None: