python kivy 异步加载图片.2020-12-09
程序员文章站
2022-07-05 20:49:45
from kivy.app import Appfrom kivy.uix.gridlayout import GridLayoutfrom kivy.uix.label import Labelfrom kivy.uix.image import Image, AsyncImage# AsyncImage异步图像,图片加载速度更快labelStr = '''[b]Kivy Gif[/b] test test test'''class TestApp(App): d....
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.image import Image, AsyncImage
# AsyncImage异步图像,图片加载速度更快
labelStr = '''
[b]Kivy Gif[/b]
test test test
'''
class TestApp(App):
def build(self):
self.title = 'Kivy Gif'
layout = GridLayout(cols=1)
lab = Label(text=labelStr, markup=True,
font_size='30sp', size_hint_y=None, height=100)
# img = Image(source='Gif1.gif', anim_delay=1.0 / 24)
img = AsyncImage(source='Gif1.gif', anim_delay=1.0 / 24)
# 异步图像加载
# 重新定义帧率:每秒24帧
layout.add_widget(lab)
layout.add_widget(img)
return layout
if __name__ == '__main__':
TestApp().run()
本文地址:https://blog.csdn.net/u012336596/article/details/110921781
上一篇: 大骨头的做法不只是炖汤
下一篇: 计算数据集均值方差