Is it possible to link widgets.Play with widgets.Image

24 views
Skip to first unread message

Alex Liberzon

unread,
May 20, 2017, 1:29:53 PM5/20/17
to Project Jupyter
Hi, 

I cannot figure out if it's possible to make a slideshow of a list of images using ipywidgets.widgets.Image and ipywidgets.widgets.Play. Can you please help me with an idea of how to link an integer value used by Play() and the image value by Image() ? 

A minimal example would be 

imglist = ['img1.jpg','img2'.jpg']

# file = open("images/WidgetArch.png", "rb")
# image = file.read()
imageview = widgets.Image(
    file = open(imglist[value],'rb'),
    image = file.read(),
    value=image,
    format='png',
    width=300,
    height=400
)

play = widgets.Play(
#     interval=10,
    value=0,
    min=0,
    max=1,
    step=1,
    description="Press play",
    disabled=False
)
# slider = widgets.IntSlider()
widgets.jslink((play, 'value'), (imageview, 'value'))
widgets.VBox([play, imageview])


Thanks in advance,
Alex

Reply all
Reply to author
Forward
0 new messages