3

Is it possible to make the input form for the ipywidget interact larger? When I use the following code, for example, the field is to small for the title and it looks messy.

# python code to run in jupyter notebook
%pylab inline
from ipywidgets import interact
def f(x):
    plot(range(10))
    title(x)
interact(f, x=['AbCd'*10])
Soerendip
  • 7,684
  • 15
  • 61
  • 128

1 Answers1

4

1) Swapping your interact for an interactive will let you return the final widget, modify it, and then display it.

2) Manually specify the layout of the dropdown by finding the first child of the interactive, then setting the layout width in pixels. In a forthcoming release it looks like you will be able to set width='initial' to size automatically. (revelant github issue)


# python code to run in jupyter notebook
%pylab inline
from ipywidgets import interact, interactive, Layout
def f(x):
    plot(range(10))
    title(x)
int_widget = interactive(f, x=['AbCd'*10])
int_widget.children[0].layout = Layout(width='500px')
display(int_widget)

enter image description here

ac24
  • 5,325
  • 1
  • 16
  • 31