异步加载图片
1 from kivy.app import App 2 from kivy.uix.gridlayout import GridLayout 3 from kivy.uix.image import Image, AsyncImage 4 5 6 class ImageBoxLayout(GridLayout): 7 ... 8 9 10 class TestApp(App): 11 def build(self): 12 self.title = "测试标题" 13 return ImageBoxLayout() 14 15 16 if __name__ == '__main__': 17 TestApp().run()
kv语言:
1 <ImageBoxLayout>: 2 canvas: 3 Color: 4 rgba:[1,1,1,1] 5 Rectangle: 6 size:self.size 7 pos:self.pos 8 source:"20190701154816.jpg" 9 AsyncImage: 10 source:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp3.itc.cn%2Fimages01%2F20200831%2F4e9b481826124821aeec987d9d0c880f.jpeg&refer=http%3A%2F%2Fp3.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1656201638&t=b9a5406b7d1b0c993116a1ab0df96b37"
运行结果显示:
标签:__,控件,入门,self,kivy,import,size From: https://www.cnblogs.com/shixiaogu/p/16731652.html