image.py 506 B

1234567891011121314151617181920
  1. from pathlib import Path
  2. from typing import Union
  3. from nicegui.dependencies import register_component
  4. from .mixins.source_element import SourceElement
  5. register_component('image', __file__, '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)