本文整理匯總了Python中dash_html_components.Div方法的典型用法代碼示例。如果您正苦於以下問題:Python dash_html_components.Div方法的具體用法?Python dash_html_components.Div怎麽用?Python dash_html_components.Div使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dash_html_components
的用法示例。
在下文中一共展示了dash_html_components.Div方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getLayout
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def getLayout():
return html.Div([
html.H1(id='Title1',children='Multiple intervals in a single page',style={'text-align':'center'}),
html.Div(id='Title2', children='''
Test multiple intervals in a single page.
''',style={'margin-bottom':'50px', 'text-align':'center'}),
html.Div('Div1',id='div1'),
html.Div('Div2',id='div2'),
html.Div('Div3',id='div3'),
dcc.Interval(
id='interval-component-1',
interval=500 # in milliseconds
),
dcc.Interval(
id='interval-component-2',
interval=300 # in milliseconds
),
dcc.Interval(
id='interval-component-3',
interval=400 # in milliseconds
)
])
示例2: compute_stats
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def compute_stats(questions: List[Question], db_path):
n_total = len(questions)
n_guesser_train = sum(1 for q in questions if q.fold == 'guesstrain')
n_guesser_dev = sum(1 for q in questions if q.fold == 'guessdev')
n_buzzer_train = sum(1 for q in questions if q.fold == 'buzzertrain')
n_buzzer_dev = sum(1 for q in questions if q.fold == 'buzzerdev')
n_dev = sum(1 for q in questions if q.fold == 'dev')
n_test = sum(1 for q in questions if q.fold == 'test')
columns = ['N Total', 'N Guesser Train', 'N Guesser Dev', 'N Buzzer Train', 'N Buzzer Dev', 'N Dev', 'N Test']
data = np.array([n_total, n_guesser_train, n_guesser_dev, n_buzzer_train, n_buzzer_dev, n_dev, n_test])
norm_data = 100 * data / n_total
return html.Div([
html.Label('Database Path'), html.Div(db_path),
html.H2('Fold Distribution'),
html.Table(
[
html.Tr([html.Th(c) for c in columns]),
html.Tr([html.Td(c) for c in data]),
html.Tr([html.Td(f'{c:.2f}%') for c in norm_data])
]
)
])
示例3: update_position_selection
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def update_position_selection(rows,derived_virtual_selected_rows):
if derived_virtual_selected_rows is None:
derived_virtual_selected_rows = []
if rows is None:
dff3 = df3
else:
dff3 = pd.DataFrame(rows)
try:
active_row_txid = dff3['txid'][derived_virtual_selected_rows[0]]
return html.Div([
html.H5("Selected position: " + active_row_txid),
html.Div(id='active_row_txid', children=active_row_txid, style={'display': 'none'})
]
)
except Exception as e:
pass
# addfunding button callback
示例4: display_graphs
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def display_graphs(n_clicks):
graphs = []
for i in range(n_clicks):
graphs.append(dcc.Graph(
id='graph-{}'.format(i),
figure={
'data': [{
'x': [1, 2, 3],
'y': [3, 1, 2]
}],
'layout': {
'title': 'Graph {}'.format(i)
}
}
))
return html.Div(graphs)
示例5: divs_list
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def divs_list():
return [html.Div([
dcc.Markdown(
'',
id='model-{}-markdown'.format(id)
),
html.P(
'',
id='model-{}-p'.format(id)
),
html.Button(
'Delete',
id='model-{}-delete-button'.format(id),
style={'width': '49%'}
),
html.Button(
'Start/Stop',
id='model-{}-toggle-button'.format(id),
style={'marginLeft': '2%', 'width': '49%'}
),
html.Hr()
], id='model-k2-{}'.format(id)) for id in IDS]
示例6: display_output
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def display_output(n_clicks):
print('display_output ' + str(n_clicks))
if n_clicks == 0:
return ''
return html.Div([
html.Div([
dcc.Input(
value='Input {}'.format(i),
id='input-{}'.format(i)
)
for i in range(10)
]),
dt.DataTable(
rows=[{'Loading': ''}],
id='new-table'),
html.Div(id='dynamic-output')
])
示例7: display_page
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def display_page(pathname):
print(pathname)
if pathname == '/':
return html.Div([
html.Div('You are on the index page.'),
# the dcc.Link component updates the `Location` pathname
# without refreshing the page
dcc.Link(html.A('Go to page 2 without refreshing!'), href="/page-2", style={'color': 'blue', 'text-decoration': 'none'}),
html.Hr(),
html.A('Go to page 2 but refresh the page', href="/page-2")
])
elif pathname == '/page-2':
return html.Div([
html.H4('Welcome to Page 2'),
dcc.Link(html.A('Go back home'), href="/"),
])
else:
return html.Div('I guess this is like a 404 - no content available')
# app.css.append_css({"external_url": "https://codepen.io/chriddyp/pen/bWLwgP.css"})
示例8: layout
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def layout(self) -> html.Div:
return html.Div(
children=[
wcc.FlexBox(
children=[
html.Div(
id=self.uuid("selector-row"),
style={"display": "none"}
if self.lock
else {"width": "15%"},
children=self.plot_option_layout(),
),
wcc.Graph(
id=self.uuid("graph-id"),
style={"height": "80vh", "width": "60%"},
),
html.Div(style={"width": "15%"}, children=self.filter_layout()),
],
)
]
)
示例9: layout
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def layout(self) -> html.Div:
style = {
"color": self.color,
"background-image": f"url({self.image_url})",
"height": f"{self.height}px",
}
if self.shadow:
style["text-shadow"] = "0.05em 0.05em 0"
if self.color == "white":
style["text-shadow"] += " rgba(0, 0, 0, 0.7)"
else:
style["text-shadow"] += " rgba(255, 255, 255, 0.7)"
return html.Div(self.title, className="_banner_image", style=style)
示例10: prepare_send
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def prepare_send():
lCache = []
cData = get_All_data()
for pair in PAIRS:
ticker = pair.ticker
exchange = pair.exchange
graph = 'live-graph-' + exchange + "-" + ticker
lCache.append(html.Br())
if (pair.Dataprepared):
lCache.append(dcc.Graph(
id=graph,
figure=cData[exchange + ticker]
))
else:
lCache.append(html.Div(id=graph))
return lCache
# links up the chart creation to the interval for an auto-refresh
# creates one callback per currency pairing; easy to replicate / add new pairs
示例11: create_description
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def create_description():
div = html.Div(
children=[
dcc.Markdown('''
The redder the outer circle, the higher the magnitude. The darker
the inner circle, the deeper the earthquake.
> Currently no organization or government or scientist is capable
> of succesfully predicting the time and occurrence of an
> earthquake.
> — Michael Blanpied
Use the table below to know more about the {} earthquakes that
exceeded magnitude 4.5 last month.
***
'''.format(data['metadata']['count']).replace(' ', '')),
],
)
return div
示例12: setUp
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def setUp(self):
"""Set up for tests. Need to provid Flask.test_client() to all tests. Further
configuration (e.g. FlaskLoginAuth) must be provided within the tests."""
server = Flask(__name__)
server.config.update(
SECRET_KEY = os.urandom(12),
)
self.app = Dash(name='app1', url_base_pathname='/app1', server=server)
self.app.layout = html.Div('Hello World!')
self.add_auth_app = Dash(name='add_auth_app', url_base_pathname='/add-auth-app', server=server)
self.add_auth_app.layout = html.Div('Hello World!')
self.multi_app_no_auth = Dash(name='multi_app_no_auth', url_base_pathname='/app-no-auth', server=server)
self.multi_app_no_auth.layout = html.Div('Hello World!')
# Will raise an error because it doesn't have the same server
self.crash_app = Dash(name='crash', url_base_pathname='/crash-app')
self.crash_app.layout = html.Div('Goodby Cruel World!')
self.server = server.test_client()
self.assertEqual(server.debug, False)
示例13: attribute_selector
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def attribute_selector(self):
return html.Div(
style={"display": "grid"},
children=[
html.Label("Surface attribute"),
html.Div(
style=self.set_grid_layout("6fr 1fr"),
children=[
dcc.Dropdown(
id=self.attr_id,
options=[
{"label": attr, "value": attr} for attr in self.attrs
],
value=self.attrs[0],
clearable=False,
),
self._make_buttons(
self.attr_id_btn_prev, self.attr_id_btn_next
),
],
),
],
)
示例14: _make_buttons
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def _make_buttons(self, prev_id, next_id):
return html.Div(
style=self.set_grid_layout("1fr 1fr"),
children=[
html.Button(
style={
"fontSize": "2rem",
"paddingLeft": "5px",
"paddingRight": "5px",
},
id=prev_id,
children="⬅",
),
html.Button(
style={
"fontSize": "2rem",
"paddingLeft": "5px",
"paddingRight": "5px",
},
id=next_id,
children="➡",
),
],
)
示例15: layout
# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Div [as 別名]
def layout(self):
return html.Div(
children=[
html.Div(
children=[
self.attribute_selector,
self.selector(
self.name_wrapper_id,
self.name_id,
"Surface name",
self.name_id_btn_prev,
self.name_id_btn_next,
),
self.selector(
self.date_wrapper_id,
self.date_id,
"Date",
self.date_id_btn_prev,
self.date_id_btn_next,
),
]
),
dcc.Store(id=self.storage_id),
]
)