options=hierarchy['country'].unique().tolist(), id='region')), ('map_subregtype', bmw.Select(value='st', options=hierarchy.columns.values.tolist(), id='map_subregtype')), ('year', bmw.Select(value=str(2050), options=[str(x) for x in years_full], id='year')), ('timeslice', bmw.Select(value='All timeslices', options=['All timeslices', 'H1', 'H2', 'H3'], id='timeslice')), ('scale_axes', bmw.RadioButtonGroup(labels=['Sync Axes', 'Scale Independently'], id='scale_axes')), ('rerender', bmw.Button(label='Re-render', button_type='success', id='rerender')), ('download', bmw.Button(label='Download CSV', button_type='success', id='download')), ('download_subreg', bmw.Button(label='Download Subregion CSV', button_type='success', id='download_subreg')), )) def initialize(): for scenario_name in scenarios: #build plots plot = {
rows = c.fetchall() return rows def updateCourseData(rows): courseData = {} courseData['id'] = [r['course_id'] for r in rows] courseData['title'] = [r['title'] for r in rows] courseData['dept'] = [r['dept_name'] for r in rows] courseData['credits'] = [r['credits'] for r in rows] courseData['instructor'] = [r['instructor'] for r in rows] table.source.data = courseData # filter by button group btnGroupLetters = wd.RadioButtonGroup(labels=list(string.ascii_uppercase), active=-1) def refreshByButton(new): letter = btnGroupLetters.labels[new] rows = fetchRows( "select * from lgu.course where title like '{}%'".format(letter)) updateCourseData(rows) btnGroupLetters.on_click(refreshByButton) # filter by text filtr = ['begins with...', '...contains...', '...ends with'] btnGroupTitle = wd.RadioButtonGroup(labels=filtr, active=1) btnGroupDept = wd.RadioButtonGroup(labels=filtr, active=1)
from bokeh.io import show, curdoc from bokeh.models import widgets as wd from bokeh.layouts import widgetbox as wb, layout import random import time # Login btnLogin = wd.Button(label="Login") btnReset = wd.Button(label="Reset") name = wd.TextInput(title="Name", placeholder="enter name ....") pwd = wd.TextInput(title="Password", placeholder="enter password ....") # Study majors = wd.RadioButtonGroup(labels=["CS", "Stat", "Math", "EIE", "Energy", "HSS", "SME"]) text = wd.Paragraph(text="Press button to start .... ") answer = wd.Paragraph(text="") btnRandom = wd.Button(label="Choose For Me") login = layout( [ [ wb(name) ], [ wb(pwd) ], [ wb(btnLogin), wb(btnReset) ] # side by side ] ) major = layout( [ [ wb(majors, width=800) ], [ wb(text, btnRandom, answer) ] ] )
attr = dict(server='10.20.213.10', database='csc1002', user='******', password='******', port=1433, as_dict=True) try: return pymssql.connect(**attr) except Exception as e: print(e) quit() # Here are UI Controls widgets GroupLetters = wd.RadioButtonGroup(labels=list(string.ascii_uppercase), active=-1) dept_input = wd.TextInput(value="", title="Department", placeholder="Seach department") title_input = wd.TextInput(value="", title="Title", placeholder="Serach title") options = wd.RadioGroup(labels=['and', 'or'], active=0, width=100, inline=True) button_refresh = wd.Button(label="Refresh") Group_choices = wd.RadioButtonGroup( name="Title", labels=['Begins with ...', '... contains ...', '... ends with'], active=1) Department_choices = wd.RadioButtonGroup( name="Department", labels=['Begins with ...', '... contains ...', '... ends with'], active=1) Text_Instruction = wd.Paragraph(text="Option")
from bokeh.io import show, curdoc, output_file from bokeh.plotting import figure from bokeh.layouts import widgetbox as wb, layout from bokeh.models import widgets as wd, ColumnDataSource from bokeh.core.properties import value import string import pymssql paragraph = wd.Paragraph(text="option") optionGroup = wd.RadioGroup(labels=["and", "or"], active=0, width=100, inline=True) btnGroupLetters = wd.RadioButtonGroup(labels=list(string.ascii_uppercase), active=-1) title_input = wd.TextInput(value="", title="Title:", placeholder="comtains....") dept_input = wd.TextInput(value="", title="Department", placeholder="contains....") btnGroupTitle = wd.RadioButtonGroup( name='title', labels=["begin with...", "...comtains...", "...ends with"], active=1) refresh = wd.Button(label="Refresh") btnGroupDept = wd.RadioButtonGroup( name='dept', labels=["begin with...", "...contains...", "...end with"], active=1)
from bokeh.io import show, curdoc from bokeh.plotting import figure from bokeh.layouts import widgetbox as wb, layout from bokeh.models import widgets as wd, ColumnarDataSource from bokeh.core.properties import value # Login btnLogin = wd.Button(label="Login") btnReset = wd.Button(label="Reset") name = wd.TextInput(title="Name", placeholder="enter name ....") pwd = wd.TextInput(title="Password", placeholder="enter password ....") login = layout([[wb(name)], [wb(pwd)], [wb(btnLogin), wb(btnReset)]]) # Study majors = wd.RadioButtonGroup( labels=["CSC", "STA", "MAT", "EIE", "ENE", "HSS", "SME"]) text = wd.Paragraph(text="Press button to start ....") answer = wd.Paragraph(text="") btnRandom = wd.Button(label="Choose for me") study = layout([[wb(majors, width=800)], [wb(text, btnRandom, answer)]]) page1 = wd.Panel(child=login, title="login") page2 = wd.Panel(child=study, title="Study") tabs = wd.Tabs(tabs=[page1, page2]) curdoc().add_root(tabs)
select_y1, select_y2, sizing_mode="fixed", width=400, height=400) vlinked = bl.row(inputs, bl.gridplot([[fig1], [fig2]])) #------------------------------------------------------------------------------ # Global controls and layout #sites = sorted(np.union1d(df.site1.unique(), df.site2.unique())) pols = sorted(df.polarization.unique(), reverse=True) cols = ["ALMA, others, auto", "Site1", "Site2"] last = [1, 2, 3, 4] global_cb = bw.CheckboxButtonGroup(labels=["Auto-correlation"] + pols, active=last) colored_by = bw.RadioButtonGroup(labels=cols, active=0) def update(): global last active = global_cb.active color = colored_by.active if color == 0: df['color'] = [ "red" if (df.site1[i] == 'A' or df.site2[i] == 'A') else "green" for i in range(len(df)) ] df.color[df.site1 == df.site2] = "blue" elif color == 1: sites = sorted(df.site1.unique())