Last active
March 5, 2020 16:35
-
-
Save robertlugg/0add523f965a11aa051dd5dc296ed923 to your computer and use it in GitHub Desktop.
ipywidgets output
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
# Goal is to capture output from print() to a nice box with scrollbars | |
# These print statements are proxies for what really does the printing, so I can't change them. | |
import ipywidgets as widgets | |
from ipywidgets import HBox, IntSlider, Text, Label, Output | |
# Attempt #1 | |
a = Output() | |
with a: | |
for i in range (50): | |
print(f"Hello {i}") | |
# Attempt #2 | |
# This seems to work | |
a = Output(layout={'border': '1px solid black', 'height': '200px', 'overflow_y': 'auto'}) | |
display(a) | |
with a: | |
for i in range (50): | |
print(f"Hello {i}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment