猕猴桃刷新图像 [英] Kivy refresh image

查看:63
本文介绍了猕猴桃刷新图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用源实例化的图像(kivy.uix.image.Image),但是我更改了源文件的数据.如何刷新图像以反映新数据?

I have an an image (kivy.uix.image.Image) instantiated with a source, but I change the source file's data. How can I refresh the image to reflect the new data?

推荐答案

由于文件名用作缓存的键,因此是硬情况. 您可以在更改源之前清除所有缓存:

Hard case, since the filename is used as key for caching. You can clear all the cache, before changing the source:

from kivy.cache import Cache
Cache.remove('kv.image')
Cache.remove('kv.texture')
# then change the source of the image

应该可以,但是效率不高.

It should be ok, but not efficient.

正如准农所说:

此外,如果您可以使用development分支或等待1.3发行版.您可以使用以下功能来实现::

Also if you can use the development branch or wait for the 1.3 release. You can use the following functions to achieve just that ::

对于图像"小部件Image.reload()

For the Image widget Image.reload()

对于核心映像Image.remove_from_cache()

For the Core Image Image.remove_from_cache()

这篇关于猕猴桃刷新图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆