【发布时间】:2021-04-06 21:15:53
【问题描述】:
请问如何从 json 文件中相应地在 MDCard 中加载图像列表? 我的 json 文件里面至少有 20 个图片链接。
.py
def load_image(self):
store = JsonStore('image.json')
image = store['PRD'].get('td01')
return image
def build(self):
store = JsonStore('image.json')
return Builder.load_file('main1.kv')
.kv
Screen:
BoxLayout:
orientation: 'vertical'
Toolbar:
title: "Testing"
Scroll:
TLayout:
TLayout2:
Card:
AsyncImage:
source: app.load_image()
Card:
AsyncImage:
source: app.load_image()
Card:
AsyncImage:
source: app.load_image()
【问题讨论】: