image.py 564 B

123456789101112131415161718192021
  1. from pathlib import Path
  2. from typing import Union
  3. from nicegui.dependencies import register_vue_component
  4. from .mixins.source_element import SourceElement
  5. register_vue_component('image', Path(__file__).parent / 'image.js')
  6. class Image(SourceElement):
  7. def __init__(self, source: Union[str, Path] = '') -> None:
  8. """Image
  9. Displays an image.
  10. :param source: the source of the image; can be a URL, local file path or a base64 string
  11. """
  12. super().__init__(tag='image', source=source)
  13. self.use_component('image')