コード例 #1
0
    else:
        if button_group2.active == 1:
            print (slider.value)
            plotToRemove = curdoc().get_model_by_name('plot')
            listOfSubLayouts.remove(plotToRemove)
            team = map_classes.Team(search_bar.value)
            nextyear = str(slider.value+1)
            years = str(slider.value)+'-'+nextyear[2:4]
            p2 = team.hex_freq(season=years)
            plotToAdd = p2
            listOfSubLayouts.append(plotToAdd)
        else:
            print (slider.value)
            plotToRemove = curdoc().get_model_by_name('plot')
            listOfSubLayouts.remove(plotToRemove)
            team = map_classes.Team(search_bar.value)
            nextyear = str(slider.value+1)
            years = str(slider.value)+'-'+nextyear[2:4]
            p2 = team.hex_accuracy(years)
            plotToAdd = p2
            listOfSubLayouts.append(plotToAdd)

#Set up callback event behavior
""" These define the attribute of each widget that is continiously checked and defines the callback functions to be run when the atribute is changed by the user."""
search.on_change('clicks', update_search_term, update_year)
button_group2.on_change('active', update_plot_type)
slider.on_change('value',update_year)

#Name the html document
curdoc().title = "GUI"
コード例 #2
0
    print(attr, old, new)
    if new:
        print('starting autoupdate')
        cb_autoupdate = curdoc().add_periodic_callback(detect_base_freq, 500)
    else:
        print('removing autoupdate')
        curdoc().remove_periodic_callback(cb_autoupdate)


checkbox_button_group = CheckboxButtonGroup(labels=["Autodetect"],
                                            active=[0, 1])
checkbox_button_group.on_change('active', autoupdate)

# This button allows to lock in the current data
detect_button = Button()
detect_button.on_change('clicks', detect_base_freq)

#%%
# make the grid & add the plots
curdoc().add_root(
    gridplot([
        p,
        widgetbox(length_slider,
                  concertpitch_slider,
                  detect_button,
                  checkbox_button_group,
                  width=400)
    ], [p_time, None], [p_f1, p_f2]))
# update every 100ms
curdoc().add_periodic_callback(update, 100)
curdoc().title = "Bandoneon Tuner"
コード例 #3
0
ファイル: streamer_v2.py プロジェクト: behinger/bandotuner
concertpitch_slider.on_change('value', bt.changeConcertPitch)

fundamental_xrange = Slider(value=bt.xrange,
                            start=5,
                            end=100,
                            step=1,
                            title="X-range")
fundamental_xrange.on_change('value', bt.change_xrange)

checkbox_button_group = CheckboxButtonGroup(
    labels=["Auto-Save to Table", "FreezeInset"], active=[])
checkbox_button_group.on_change('active', bt.startstop_autoupdate)

# This button allows to lock in the current data
detect_button = Button(label='Manual Detect and add to Table')
detect_button.on_change('clicks', bt.detect_base_freq_bokeh)

save_button = Button(label='Save Current Table')
#save_button.on_change('clicks',bt.save_table)
save_button.callback = CustomJS(args=dict(source=bt.sources['savednotes']),
                                code=open(
                                    join(dirname(__file__),
                                         "download.js")).read())

#%%
# make the grid & add the plots
widgets = widgetbox(length_slider,
                    concertpitch_slider,
                    fundamental_xrange,
                    detect_button,
                    save_button,