from logging import debug
from typing import ItemsView
import dash
from dash import Input, Output, State, html
import dash_bootstrap_components as dbc
from dash_bootstrap_components.themes import BOOTSTRAP
app = dash.Dash(external_stylesheets=[dbc.themes, BOOTSTRAP])
carousel = dbc.Carousel(
items=[
{"key": "1", "src": "/assets/05.jpg"},
{"key": "2", "src": "/assets/04.jpg"},
{"key": "3", "src": "/assets/03.jpg"},
],
controls=True, # 显示轮播上一个和下一个箭头以更改当前幻灯片。
indicators=True, # 显示一组幻灯片位置指示器
interval=2000, # 设置循环时间为2000ms,鼠标放在图片上会停止播放
ride="carousel", # 如果设置为'carousel',则在加载时自动播放轮播。
style={"height": "70", "width": "500px"},
)
app.layout = dbc.Container(carousel, fluid=True)
if __name__ == "__main__":
app.run_server(debug=True)
dash-bootstrap-轮播图
最新推荐文章于 2023-02-13 19:55:33 发布