deafrica_tools.app.widgetconstructors¶
Functions for easily defining widgets in the context of DE Africa notebooks.
These are largely customised wrappers around existing widgets.
Functions
|
Create a BoundedFloatText widget |
|
Create a Checkbox widget |
|
Create a DatePicker widget |
|
Create a Digital Earth Africa WMS layer to add to a map |
|
Create a draw control widget to add to ipyleaflet maps |
|
Create a Dropdown widget |
|
Create a HTML widget |
|
Create a Text widget |
|
Create an interactive ipyleaflet map |
- deafrica_tools.app.widgetconstructors.create_boundedfloattext(value, min_val, max_val, step_val, description='', layout={'width': '85%'})¶
Create a BoundedFloatText widget
Last modified: October 2021
- Parameters
value (float) – initial value of the widget
min_val (float) – minimum allowed value for the float
max_val (float) – maximum allowed value for the float
step_val (float) – allowed increment for the float
description (string) – descirption label to attach
layout (dictionary) – any layout commands for the widget
- Returns
float_text
- Return type
ipywidgets.widgets.widget_float.BoundedFloatText
- deafrica_tools.app.widgetconstructors.create_checkbox(value, description='', layout={'width': '85%'})¶
Create a Checkbox widget
Last modified: July 2022
- Parameters
value (string) – initial value of the widget; True or False
description (string) – description label to attach
layout (dictionary) – any layout commands for the widget
- Returns
dropdown
- Return type
ipywidgets.widgets.widget_selection.Dropdown
- deafrica_tools.app.widgetconstructors.create_datepicker(description='', value=None, layout={'width': '85%'})¶
Create a DatePicker widget
Last modified: July 2022
- Parameters
description (string) – descirption label to attach
layout (dictionary) – any layout commands for the widget
- Returns
date_picker
- Return type
ipywidgets.widgets.widget_date.DatePicker
- deafrica_tools.app.widgetconstructors.create_dea_wms_layer(product, date)¶
Create a Digital Earth Africa WMS layer to add to a map
Last modified: October 2021
- Parameters
product (string) – The Digital Earth Africa product to load (e.g. ‘gm_s2_annual’)
date (string (yyyy-mm-dd format)) – The date to load the product for
- Returns
time_wms
- Return type
ipyleaflet WMS layer
- deafrica_tools.app.widgetconstructors.create_drawcontrol(draw_controls=['rectangle', 'polygon', 'circle', 'polyline', 'marker', 'circlemarker'], rectangle_options={}, polygon_options={}, circle_options={}, polyline_options={}, marker_options={}, circlemarker_options={})¶
Create a draw control widget to add to ipyleaflet maps
Last modified: October 2021
- Parameters
draw_controls (list) – List of draw controls to add to the map. Defaults to adding all Viable options are ‘rectangle’, ‘polygon’, ‘circle’, ‘polyline’, ‘marker’, ‘circlemarker’
rectangle_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
polygon_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
circle_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
polyline_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
marker_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
circlemarker_options (dict) – Options to customise the appearence of the relevant shape User can supply, or leave blank to get default DE Africa appearence
- Returns
draw_control
- Return type
ipyleaflet.leaflet.DrawControl
- deafrica_tools.app.widgetconstructors.create_dropdown(options, value, description='', layout={'width': '85%'})¶
Create a Dropdown widget
Last modified: October 2021
- Parameters
options (list) – a list of options for the user to select from
value (string) – initial value of the widget
description (string) – descirption label to attach
layout (dictionary) – any layout commands for the widget
- Returns
dropdown
- Return type
ipywidgets.widgets.widget_selection.Dropdown
- deafrica_tools.app.widgetconstructors.create_html(value)¶
Create a HTML widget
Last modified: October 2021
- Parameters
value (string) – HTML text to display
- Returns
html
- Return type
ipywidgets.widgets.widget_string.HTML
- deafrica_tools.app.widgetconstructors.create_inputtext(value, placeholder, description='', layout={'width': '85%'})¶
Create a Text widget
Last modified: October 2021
- Parameters
value (string) – initial value of the widget
placeholder (string) – placeholder text to display to the user before intput
description (string) – descirption label to attach
layout (dictionary) – any layout commands for the widget
- Returns
input_text
- Return type
ipywidgets.widgets.widget_string.Text
- deafrica_tools.app.widgetconstructors.create_map(map_center=(4, 20), zoom_level=3, basemap=ipyleaflet.basemaps.OpenStreetMap.Mapnik, basemap_name='Open Street Map')¶
Create an interactive ipyleaflet map
Last modified: October 2021
- Parameters
map_center (tuple) – A tuple containing the latitude and longitude to focus on. Defaults to center of Africa, (4, 20)
zoom_level (integer) – Zoom level for the map Defaults to 3 to view all of Africa
basemap (ipyleaflet basemap (dict)) – Basemap to use, can be any from https://ipyleaflet.readthedocs.io/en/latest/api_reference/basemaps.html Defaults to Open Street Map (basemaps.OpenStreetMap.Mapnik)
basemap_name (string) – Layer name for the basemap
- Returns
m – interactive ipyleaflet map
- Return type
ipyleaflet.leaflet.Map