本文整理汇总了Python中bokeh.models.Button.callback方法的典型用法代码示例。如果您正苦于以下问题:Python Button.callback方法的具体用法?Python Button.callback怎么用?Python Button.callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.models.Button
的用法示例。
在下文中一共展示了Button.callback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_callback_property_executes
# 需要导入模块: from bokeh.models import Button [as 别名]
# 或者: from bokeh.models.Button import callback [as 别名]
def test_callback_property_executes(self, bokeh_model_page):
button = Button(css_classes=['foo'])
button.callback = CustomJS(code=RECORD("clicked", "true"))
page = bokeh_model_page(button)
button = page.driver.find_element_by_css_selector('.foo .bk-btn')
button.click()
results = page.results
assert results == {'clicked': True}
assert page.has_no_console_errors()
示例2: test_data_table_selected_highlighting
# 需要导入模块: from bokeh.models import Button [as 别名]
# 或者: from bokeh.models.Button import callback [as 别名]
def test_data_table_selected_highlighting(output_file_url, selenium, screenshot):
# Create a DataTable and Button that sets a selection
data = dict(x = list(range(10)))
source = ColumnDataSource(data=data)
columns = [TableColumn(field="x", title="X")]
data_table = DataTable(source=source, columns=columns)
button = Button(label="Click")
button.callback = CustomJS(args=dict(source=source), code="""
source['selected']['1d'].indices = [1, 2]
source.change.emit();
""")
# Save the table and start the test
save(column(data_table, button))
selenium.get(output_file_url)
assert has_no_console_errors(selenium)
# Click the button to select the rows
button = selenium.find_element_by_class_name('bk-bs-btn')
button.click()
screenshot.assert_is_valid()
示例3: figure
# 需要导入模块: from bokeh.models import Button [as 别名]
# 或者: from bokeh.models.Button import callback [as 别名]
# create a plot and style its properties
fig = figure(width=plot_width, height=plot_height, x_axis_type="datetime", toolbar_location='above', tools="pan,box_zoom,xwheel_zoom,reset,save");
fig.quad(top='price_max', bottom='price_min', left='time_left', right='time_right', source=plot_data, color=Blues3[1])
fig.line(x='time_mid', y='price_mean', source=plot_data, color=Blues3[0]);
# add widgets
title=Div(text="<h1>Stock Price</h1>")
description=Paragraph(text='Type in a symbol or select one from Dow 30 \
and Nasdaq 100, and its price on 5/6/2010 will be plotted shortly. Due to its \
high frequency, the series plotted is downsampled, with the shaded area denoting \
the min/max prices at every time point. Details can be revealed by zoom in with \
tools above the plot.')
symbol_box=TextInput(value='', title='Type Symbol', width=100)
market_select = Select(value='', title='Select ', width=100, options=['', 'Dow 30', 'Nasdaq 100'])
symbol_select = Select(value='', title='Symbol ', width=100, options=[])
button = Button(label="GO", button_type='success', width=100)
progress_bar=PreText()
# add callbacks and interactions
button.callback=CustomJS(code=dims_jscode, args=dict(plot=fig, dims=dims))
button.on_click(button_click)
fig.x_range.on_change('start', update_plot)
#fig.x_range.on_change('end', update_plot)
fig.x_range.callback = CustomJS(code=dims_jscode, args=dict(plot=fig, dims=dims))
market_select.on_change('value', update_symbol_select)
symbol_select.on_change('value', update_symbol_box)
# put the button and plot in a layout and add to the document
doc=curdoc()
doc.add_root(column([widgetbox([title, description]), row([widgetbox(symbol_box), market_select,symbol_select]), button, progress_bar, fig], sizing_mode='scale_width'))