示例#1
0
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)
    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)
refresh = wd.Button(label='Refresh')
title_input = wd.TextInput(value='', title='Title:', placeholder='')
dept_input = wd.TextInput(value='', title='Department:', placeholder='')
optionGroup = wd.RadioGroup(labels=['and', 'or'],
                            active=0,
                            width=100,
                            inline=True)


def refreshByFilter():
    conj = optionGroup.labels[optionGroup.active]
    title, dept = title_input.value, dept_input.value

    titleCondition = "title like '{}'".format(
        [title + '%', '%' + title + '%', '%' + title][btnGroupTitle.active])
    deptCondition = "dept_name like '{}'".format(
        [dept + '%', '%' + dept + '%', '%' + dept][btnGroupTitle.active])
    rows = fetchRows("select * from lgu.course where {} {} {}".format(
        titleCondition, conj, deptCondition))
    updateCourseData(rows)
示例#3
0
                               )  #Middl6e of the highest frequency bin
scSlider = widgets.Slider(title="Frequency (MHz)",
                          value=scEnd,
                          start=scStart,
                          end=scEnd,
                          step=scStep)

flSlider = widgets.Slider(title="Folding Frequency (Hz)",
                          value=psr_dict['F0'] / 2,
                          start=psr_dict['F0'] / 4,
                          end=psr_dict['F0'] * 3,
                          step=psr_dict['F0'] * .01)

question1Group = widgets.RadioGroup(labels=[
    "The plot would have 2 pulses with a larger Signal to Noise ratio",
    "The plot would have 1 pulse with a larger Signal to Noise ratio",
    "The plot would have 1 pulse with the same Signal to Noise ratio"
],
                                    active=None)

question1Button = widgets.Button(label='Submit answer', button_type='success')

question2Group = widgets.RadioGroup(labels=[
    "Lower frequencies arrive earlier than higher frequencies",
    "Higher frequencies arrive earlier than lower frequencies"
],
                                    active=None)
question2Button = widgets.Button(label='Submit answer', button_type='success')

question3Group = widgets.RadioGroup(labels=["t > 1", "t = 1", "t < 1"],
                                    active=None)
question3Button = widgets.Button(label='Submit answer', button_type='success')