Partially visible text for ipywidgets

315 views Asked by At

I have made a selection_range_slider in jupyter notebook using ipywidgets, the only issue is that we can't see the end of the second date. What modification should I make to make this visible? (see picture below)

Here is my code:

    start_date = datetime(2019, 4, 24)
    end_date = date.today()

    dates = pd.date_range(start_date, end_date, freq='D')

    options = [(date.strftime(' %d %b %Y '), date) for date in dates]
    index = (0, len(options)-1)

    selection_range_slider = widgets.SelectionRangeSlider(
        options=options,
        index=index,
        description='Dates',
        continuous_update=False,
        orientation='horizontal',
        layout={'width': '800px'},
        placeholder='Type something'
     )

    selection_range_slider.observe(change_scatter_chart, names="value")
    selection_range_slider

    widgets.VBox([selection_range_slider, fig])
1

There are 1 answers

0
Artashes On

1st option: Modify layout={'width' : '800px'} into layout={'width' : '700px'}

or

2nd option: put this at the beginning of your script

from IPython.display import display, HTML
display(HTML(data="""<style>div#notebook-container{ width: 100%; }</style>"""))