At the time of writing the code, I was unaware that in Python, there is no static keyword, and object-specific attributes should be defined in init. All the attributes used are now defined outside init, which is the way to do it in many languages, but not python, as in this case, these attributes become static, i.e. class-bound, not instance-bound. In other words, defining a second instance of the class will overwrite these attributes (or cause weird behaviour like the number of frames is stored from the previous instance) also for the first instance, as the attributes are shared in all instances of the class.
I have observed this and thought it a bug at first, which led me to add the dirty_close() function, which solves the issue.
At the time of writing the code, I was unaware that in Python, there is no static keyword, and object-specific attributes should be defined in init. All the attributes used are now defined outside init, which is the way to do it in many languages, but not python, as in this case, these attributes become static, i.e. class-bound, not instance-bound. In other words, defining a second instance of the class will overwrite these attributes (or cause weird behaviour like the number of frames is stored from the previous instance) also for the first instance, as the attributes are shared in all instances of the class.
I have observed this and thought it a bug at first, which led me to add the dirty_close() function, which solves the issue.