ipyleaflet

  • Installation
  • Usage
  • Map and basemaps
  • Layers
  • Controls
  • API Reference
  • Related projects
  • Tile Layer
  • Local Tile Layer
  • Magnifying Glass
  • Marker
  • Icon
  • AwesomeIcon
  • DivIcon
  • Popup
  • WMS Layer
  • Image overlay and Video overlay
  • AntPath
  • Polyline
  • Polygon/Multipolygon
  • Rectangle
  • Circle
  • Circle Marker
  • Marker Cluster
  • Heatmap
  • Velocity
  • Layer Group
  • GeoJSON
  • GeoData
  • Choropleth
  • Vector Tile Layer
  • WKTLayer
On this page
  • Example
  • Attributes and methods

Popup#

Example#

from ipywidgets import HTML

from ipyleaflet import Map, Marker, Popup

center = (52.204793, 360.121558)

m = Map(center=center, zoom=9, close_popup_on_click=False)

marker = Marker(location=(52.1, 359.9))
m.add_layer(marker)

message1 = HTML()
message2 = HTML()
message1.value = "Try clicking the marker!"
message2.value = "Hello <b>World</b>"
message2.placeholder = "Some HTML"
message2.description = "Some HTML"

# Popup with a given location on the map:
popup = Popup(
    location=center,
    child=message1,
    close_button=False,
    auto_close=False,
    close_on_escape_key=False
)
m.add_layer(popup)

# Popup associated to a layer
marker.popup = message2

m

Attributes and methods#

class ipyleaflet.leaflet.Popup(**kwargs)[source]#

Popup class.

Popup element that can be placed on the map.

location#

The tuple containing the latitude/longitude of the popup.

Type

tuple, default (0, 0)

child#

Child widget that the Popup will contain.

Type

object, default None

min_width#

Minimum width of the Popup.

Type

int, default 50

max_width#

Maximum width of the Popup.

Type

int, default 300

max_height#

Maximum height of the Popup.

Type

int, default None

auto_pan#

Set it to False if you don’t want the map to do panning animation to fit the opened popup.

Type

boolean, default True

auto_pan_padding#
Type

tuple, default (5, 5)

keep_in_view#

Set it to True if you want to prevent users from panning the popup off of the screen while it is open.

Type

boolean, default False

close_button#

Whether to show a close button or not.

Type

boolean, default True

auto_close#

Whether to automatically close the popup when interacting with another element of the map or not.

Type

boolean, default True

close_on_escape_key#

Whether to close the popup when clicking the escape key or not.

Type

boolean, default True

close_popup()[source]#

Close the popup on the bound map.

open_popup(location=None)[source]#

Open the popup on the bound map.

Parameters

location (list, default to the internal location) – The location to open the popup at.

previous

DivIcon

next

WMS Layer

© Copyright (c) Jupyter Development Team.

Created using Sphinx 4.5.0.