def updateviewcontrol(): global UI_viewcontrol, list_slider, confidence_list_slider, security_list, list_relative_controls, floattext_uncertainty list_slider = [] confidence_list_slider = [] security_list = [] #list_security=list(dict_settings['security'].keys()) # Original line list_security = list(dict_settings['security'].values() ) # Changed the name next to sliders to ticker name. for n in range(len(dict_settings['security'])): #temp_slider=FloatSlider(value=Pi[n], description=list_security[n], continuous_update=False, max=0.2, min=-0.2, readout_format='.2%', step=0.2/100,style={'description_width':'100PX'}) temp_slider = FloatSlider( value=Pi[n], description='View on Asset', max=0.2, min=-0.2, readout_format='.2%', step=0.2 / 100, style={'description_width': '100PX'} ) #Slider Specficiations. Pi[n] contains the [primary 'view'] and is the starting point of the slider. max,min specify the maximum amount of return you can spec on an asset class. description=list_security[n]--> contains the name attached to the left of each slider. #display(temp_slider) # this command was required to forcefully display sliders when bqplot did not use to work. It is no longer required as Bqplot now works on the jupyter notebook. temp_slider.observe(run_viewmodel) list_slider.append(temp_slider) floattext_confidence = FloatSlider( description='Confidence of View', value=0.8, style={'description_width': '150PX'}, readout_format='.2%', max=1, min=0, step=0.5 / 100) floattext_confidence.observe(run_viewmodel) confidence_list_slider.append(floattext_confidence) security_label = Label(list_security[n]) security_label.observe(run_viewmodel) security_list.append(security_label) list_relative_controls = [] sec_dropdown_options = OrderedDict( zip(['None'] + list(dict_settings['security'].keys()), range(len(dict_settings['security']) + 1))) for n in range(3): dropdown1 = Dropdown(options=sec_dropdown_options, layout={'width': '100px'}) dropdown2 = Dropdown(options=sec_dropdown_options, layout={'width': '100px'}) label = Label(value='over', layout={'width': '30px'}) float_value = FloatSlider(description='by', value=0, readout_format='.2%', max=0.2, min=0, style={'description_width': 'initial'}, step=0.1 / 100, layout={'width': '200px'}) float_value.observe(run_viewmodel) relative_box = HBox([dropdown1, label, dropdown2, float_value]) list_relative_controls.append(relative_box) header_abs_html = HTML( '<p style="color: white;">{}</p>'.format('Absolute Views')) header_rel_html = HTML( '<p style="color: white;">{}</p>'.format('Relative Views'), layout={'margin': '20px 0px 0px 0px'}) UI_viewcontrol = [ header_abs_html, VBox([ HBox([ VBox(security_list), VBox(list_slider), VBox(confidence_list_slider) ]) ]), header_rel_html ] #, VBox(list_relative_controls), VBox([floattext_confidence])]