kivy / kivy

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
https://kivy.org
MIT License
17.62k stars 3.06k forks source link

Problem in core Image.anim_avaible #5493

Open krow89 opened 6 years ago

krow89 commented 6 years ago

Hi... I am a Kivy begginer and (more importantly) entusiast... Anyway i found (maybe) a strange behaviour on kivy.core.image.Image class... First some code that illustrate:

from kivy.core.image import Image as CoreImage
# ... other code
image= CoreImage.load( 'test_image.gif' )

# In the next line there is the problem... With animated gif, 
# I expect a 'True' but it finish with a printed 'False'
print image.anim_avaible

I dont understand the reason behind but, reading some kivy code, i have conclused that need referencing image texture before attr anim_avaible get right value:

from kivy.core.image import Image as CoreImage
# ... other code
image= CoreImage.load( 'test_image.gif' )

# Here reference image texture
tex= image.texture

# Now no problem in next line with animated gif... True is returned
print image.anim_avaible

Is normal this behaviour? It' s wanted? Thanks

welcome[bot] commented 6 years ago

👋 Thanks for opening your first issue here! Be sure to follow the issue template!

KeyWeeUsr commented 6 years ago

It appears to me that it's this line that actually starts setting the property:

https://github.com/kivy/kivy/blob/48418bd22b930640012d686846fe5342f7ad374f/kivy/core/image/__init__.py#L789

which is basically a part of Image.texture(). If you call it (and texture is a property), it executes that function, thus sets _anim_available to True. I'm not sure whether the current behavior is correct because the docs appear to me like describing the availability of the animation no matter what (without accessing other object attributes before).

krow89 commented 6 years ago

Exactly.... I dont think this is the right behaviour (it's really no sense for me and bug prone)