Está en la página 1de 5

7/1/2021 Ipweight - Jupyter Notebook

In [3]: import ipywidgets as widgets


from IPython.display import display

In [12]: #floatslider
x=widgets.FloatSlider(min=0,max=12.5,step=0.1,value=0.5,description='Test',orient
display(x)

Test 0.50

In [13]: #IntRangeSlider
x= widgets.IntRangeSlider(value=[5,7],min=0,max=10,step=1,description='Test',disa
display(x)

Test 5–7

In [14]: #FloatRangeSlider
x= widgets.FloatRangeSlider(value=[5.0,7.0],min=0,max=10.5,step=1,description='Te
display(x)

Test 5.00 – 7.00

In [25]: #IntProgress
x=widgets.IntProgress(
value=7,
min=1,
max=100,
description='Loading',
bar_style='danger',
style={'bar_color':'red'},
orientation='horizontal')
display(x)

Loading

In [26]: x=widgets.FloatProgress(
value=7,
min=0.0,
max=10.5,
description='Loading',
bar_style='danger',
style={'bar_color':'red'},
orientation='horizontal')
display(x)

Loading

localhost:8888/notebooks/Ipweight.ipynb# 1/5
7/1/2021 Ipweight - Jupyter Notebook

In [29]: #intText
x=widgets.IntText(value=7,description='Any')
display(x)

Any 7

In [28]: #FloatText
x=widgets.FloatText(value=7.5,description='Any')
display(x)

Any 8.5

In [38]: #Boolean Weigets


# There are Three widgets that are designed to display a boolean value.
x=widgets.ToggleButton(value=False,description='Click Me',button_style='info',ico
display(x)

 Click Me

In [ ]: #CheckBox
#value: it specifies the value of the checkbox
#indent : parameter ,which are true(default) or false

In [40]: ​
x=widgets.Checkbox(value=True,description='Check me',indent=False)
display(x)

Check me

In [41]: #vaild
# it is provide read only indicator

x=widgets.Valid(value=True,description='Check me')
display(x)

Check me 

In [51]: #selection Widgets


#Dropdown
x=widgets.Dropdown(options=[('good',4),('very good',5),('Bad',2)],value=4,descrip

display(x)

Example Bad

localhost:8888/notebooks/Ipweight.ipynb# 2/5
7/1/2021 Ipweight - Jupyter Notebook

In [52]: # ipywidgets also know as jupyter -widgets


#1.numeric widgets

#intslider,floatslider,intprogress,floatprogress,intrangeslider,floatrangeslide

import ipywidgets as w
from IPython.display import display

In [53]: #intslider
x=w.IntSlider(value=4,min=0,max=10,description='Demo IntSlider',orientation='hori
display(x)

Demo IntSl… 10

In [55]: x=w.FloatSlider(value=4.1,min=.10,max=10.0,description='Demo IntSlider',orientati


display(x)

Demo IntSl… 4.30

In [57]: #intRangeslider
x=w.IntRangeSlider(value=[100,150],min=100,max=200,description='Demo IntSlider',o
display(x)

Demo IntSl… 100 – 150

In [58]: x=w.FloatRangeSlider(value=[100,150],min=100,max=200,description='Demo IntSlider'


display(x)

Demo IntSl… 100.00 – 150

In [59]: #IntProgress
x=w.IntProgress(value=4,min=0,max=10,description='loading',style={'bar_color':'gr
display(x)

loading

In [61]: #intText
x=w.IntText(value=7,description='Any')
display(x)

Any 36

localhost:8888/notebooks/Ipweight.ipynb# 3/5
7/1/2021 Ipweight - Jupyter Notebook

In [62]: #FloatText
x=w.FloatText(value=7.5,description='Any')
display(x)

Any 58.5

In [69]: #boolean widgets


#-------------------------------------------------
#1.ToggleButton
#2.Checkbox
#3.Valid
x=w.ToggleButton(value=True,description='Click',button_style='info',icon='check')
display(x)
#button_style='info'#success,warning,danger

 Click

In [70]: x=w.Checkbox(value=False,description='Check me',indent=True)


display(x)

​ Check me

In [73]: x=w.Valid(value=True,description='Check me',indent=True)


display(x)

Check me 

In [78]: #Selection widgets


#1Dropdown
x=w.Dropdown(options=[3,5,6,7,9],value=5,description='plz select')
display(x)

plz select 5

In [79]: x=w.Dropdown(options=[('Excelent',5),('Very Good',4),('good',3),('Bad',2),('poor'


value=5,description='Feedback')
display(x)

Feedback Bad

In [82]: x=w.ColorPicker(description='plz select color',value='black')


display(x)

plz select c… black

localhost:8888/notebooks/Ipweight.ipynb# 4/5
7/1/2021 Ipweight - Jupyter Notebook

In [84]: x=w.RadioButtons(options=['Paneer Pizza','chees Pizza','Zeera Paneer Pizza'],desc


display(x)

Pizza type Paneer Pizza


chees Pizza
Zeera Paneer Pizza

In [ ]: ​

localhost:8888/notebooks/Ipweight.ipynb# 5/5

También podría gustarte