Hello Pythonista friends,
Me again ;-) with a simple question which could not be answered by the documentation: Is there any kind of useable destructor for a Scene object? When terminating the program I would like to save some data which is created dynamically during the runtime and as I see for the moment the nicest solution would be a member function within my class (the class is derived from scene.Scene). Sometimes I have used
__del__in other classes but it does not seem to work in a stable way. Is there a function within Scene which is called when the scene is closed and all nodes are still available?
From the scene docs, there are a few methods which you can define:
Gets called automatically when the home button is pressed while a scene is running. You can override this to save persistent state for example. The default implementation does nothing.
Gets called automatically when a scene is resumed (after being sent to the background with the home button). The default implementation does nothing.
Gets called automatically when a scene is stopped (by tapping the “x” button). You can override this to save persistent state. The default implementation does nothing.
Thanks, I will try this. I was so focused on the word 'destructor' that I missed them.