lundi 17 juin 2019

How to retrive values of checkbox in jupyter widget?

how can i retrive list of values that i have selected in checkbox?

from ipywidgets import Checkbox, interact
from IPython.display import display
option = ['one', 'two', 'three']
chk = [Checkbox(description=option[i]) for i in range(len(option))]
display(*chk)

for example if i choose 'one' and 'two' how can i print ['one', 'two']?

enter image description here

p.s i have another question as well. Is it possible to put dictionary instead of list as a checkbox values? for example {'one':1, 'two':2, 'three':3} in this case if i choose 'one', i will get '1'? Thanks




Aucun commentaire:

Enregistrer un commentaire