def __init__(self): self._compound_type = 'acid' # compound selector options = get_compound_list('H', 'acid') self._compound = widgets.Select(options=options, layout=widgets.Layout(flex='0 0 auto', width='120px', height=_element_height)) self._massfrac = widgets.BoundedFloatText(min=0., max=1., layout=widgets.Layout(flex='2 1 auto'), width='auto') self._box = widgets.HBox(children=(self._compound, widgets.Label('MF acid'), self._massfrac), layout=widgets.Layout(display='flex', flex_direction='row'))
def __init__(self): self._compound_type = 'acid' # compound selector options = get_compound_list('H', 'acid') self._compound = widgets.Select(options=options, layout=widgets.Layout( flex='0 0 auto', width='120px', height=_element_height)) self._massfrac = widgets.BoundedFloatText( min=0., max=1., layout=widgets.Layout(flex='2 1 auto'), width='auto') self._box = widgets.HBox(children=(self._compound, widgets.Label('MF acid'), self._massfrac), layout=widgets.Layout(display='flex', flex_direction='row'))
def _populate(self, sender, *args, **kwargs): element_name = self._element.value out = get_compound_list(element_name, self._compound_type) if out is not None: self._compound.options = list(map(str, out))