我正在执行此操作以显示多个带有破折号的图像,但是它显然不起作用,因为它仅显示一个图像。
for i in images:
app.layout = html.Div([
html.Div([
html.A([
html.Img(
src=app.get_asset_url(i),
style={
'height' : '40%',
'width' : '40%',
'float' : 'left',
'position' : 'relative',
'padding-top' : 0,
'padding-right' : 0
}
)
], href='https://www.google.com'),
])
])
最简单的方法是什么。考虑到这些是图像而不是情节。
答案 0 :(得分:1)
我设法使它像这样
def generate_thumbnail(image):
return html.Div([
html.A([
html.Img(
src = app.get_asset_url(i),
style = {
'height': '40%',
'width': '40%',
'float': 'left',
'position': 'relative',
'padding-top': 0,
'padding-right': 0
}
)
], href = 'https://www.google.com'),
])
images_div = []
for i in images:
images_div.append(generate_thumbnail(i))
app.layout = html.Div(images_div)