Created
January 27, 2019 14:18
-
-
Save WillKoehrsen/62b22c651565d85959523196444cf297 to your computer and use it in GitHub Desktop.
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
# Create widgets | |
directory = widgets.Dropdown(options=['images', 'nature', 'assorted']) | |
images = widgets.Dropdown(options=os.listdir(directory.value)) | |
# Updates the image options based on directory value | |
def update_images(*args): | |
images.options = os.listdir(directory.value) | |
# Tie the image options to directory value | |
directory.observe(update_images, 'value') | |
# Show the images | |
def show_images(fdir, file): | |
display(Image(f'{fdir}/{file}')) | |
_ = interact(show_images, fdir=directory, file=images) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment