from ipywidgets import interact_manual
from ipywidgets import widgets
from IPython.display import Image
from requests import get
def get_xkcd(num):
template = 'https://xkcd.com/{0:d}/info.0.json'
url = template.format(num)
json = get(url).json()
return Image(json['img'])
last = get('https://xkcd.com/info.0.json').json()['num']
widget = widgets.IntSlider(min=1, max=last, step=1, value=last,
continuous_update=False)
xkcd = interact_manual(get_xkcd, num=widget)
interactive(children=(IntSlider(value=2246, continuous_update=False, description='num', max=2246, min=1), Butt…
The XKCD strip from https://xkcd.com/ is licensed under a Creative Commons Attribution-NonCommercial 2.5 License.