Last active
June 29, 2019 16:43
-
-
Save jtpio/f4d1a86b7eb08506b8f69d86eee9058f to your computer and use it in GitHub Desktop.
ipywidgets 5.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ipywidgets-5 | |
channels: | |
- conda-forge | |
dependencies: | |
- bqplot=0.11.5 | |
- ipyleaflet=0.10.8 | |
- jupyterlab=1.0 | |
- gpxpy=1.3.5 | |
- pandas=0.24 | |
- pip | |
- nodejs | |
- voila=0.0.13 | |
- pip: | |
- ipywidgets==7.5.0rc1 | |
- srtm.py==0.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from ipyleaflet import Map, basemaps, WidgetControl" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from ipywidgets import IntSlider, ColorPicker, Button, link" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"m = Map(center=(46.01, 6.16), zoom=12, basemap=basemaps.Stamen.Terrain)\n", | |
"m" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"zoom_slider = IntSlider(description='Zoom level:', min=0, max=15, value=7)\n", | |
"link((zoom_slider, 'value'), (m, 'zoom'))\n", | |
"widget_control1 = WidgetControl(widget=zoom_slider, position='topright')\n", | |
"m.add_control(widget_control1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"color_picker = ColorPicker(description='Pick a color:')\n", | |
"widget_control2 = WidgetControl(widget=color_picker, position='bottomright')\n", | |
"m.add_control(widget_control2)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Dynamically change the widget" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"widget_control2.widget = Button(description='Click me!')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Create a custom minimap" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"minimap = Map(\n", | |
" zoom_control=False, attribution_control=False, \n", | |
" zoom=5, center=m.center, basemap=basemaps.Stamen.Terrain\n", | |
")\n", | |
"minimap.layout.width = '150px'\n", | |
"minimap.layout.height = '150px'\n", | |
"link((minimap, 'center'), (m, 'center'))\n", | |
"minimap_control = WidgetControl(widget=minimap, position='bottomleft')\n", | |
"m.add_control(minimap_control)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment