leaflet.py 505 B

1234567891011121314
  1. from typing import Tuple
  2. from nicegui import ui
  3. class leaflet(ui.element, component='leaflet.js'):
  4. def __init__(self) -> None:
  5. super().__init__()
  6. ui.add_head_html('<link href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" rel="stylesheet"/>')
  7. ui.add_head_html('<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>')
  8. def set_location(self, location: Tuple[float, float]) -> None:
  9. self.run_method('set_location', location[0], location[1])