Last active
October 8, 2018 00:03
-
-
Save gottadiveintopython/cc23a1ecaa6aa5ffd8a2f60445478eaf to your computer and use it in GitHub Desktop.
A situation that 'Animation._instances' keeps getting fat.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script shows you a situation that 'Animation._instances' keeps getting | |
# fat. I'm not sure this should be fixed or not. | |
import gc | |
from kivy.animation import Animation | |
from kivy.app import runTouchApp | |
from kivy.uix.widget import Widget | |
from kivy.clock import Clock | |
# If you run this script on master branch, you have to implement | |
# 'Parallel.cancel_property()'. For example like this: | |
# from kivy.animation import Parallel, Sequence | |
# Parallel.cancel_property = Sequence.cancel_property | |
def func(*args): | |
gc.collect() | |
print(Animation._instances) | |
anim = Animation(x=100) & Animation(y=100) | |
target = Widget() | |
anim.start(target) | |
Clock.schedule_once(lambda *args: anim.cancel_property(target, 'x'), .5) | |
Clock.schedule_interval(func, 1.2) | |
runTouchApp(Widget()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment