ScreenManager.clear_widgets()
What should ScreenManager.clear_widgets() do? At the moment, it can change its "current" attribute as it is iterating through the screens: https://gist.github.com/cropleyb/b3f65d29fddc579ce741 (unless the current screen is the last screen to be iterated over)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Good find. I think it should remove all screens and set current to None.
Looking into this one. @dessant if we make it remove all screens than will it not violate the removes all children rule that is given in documentation?
@rastogiachyut could you link and quote? I'm not sure which rule that is.
I meant this -> http://kivy.org/docs/api-kivy.uix.widget.html?highlight=clear_widget#kivy.uix.widget.Widget.clear_widgets Did I misinterpret it? "added to this widget" means all children of this widget right.
It means with no arguments, all children are removed, but only the specified widgets are removed if you pass a list to that method.
from your first comment I understood that you want to delete the current screen too(along with all the children) which I think strays from its regular implementation, is that what you think it should do?. should I ask other devs for their opinions?
I really don't see the problem there, an empty screenmanager is a legit use case, by calling sm.clear_widgets(), we should achieve the same state that a newly initialized screenmanager has, without any children.
Can you explain exactly what do you find problematic in this behavior?
Yes, it is a valid use case. I was confusing theory with implementation cause when i set screenmanager.current = None it throws an exception. I think I understand the problem now,when we do ScreenManager.clear_widgets() it removes only the current screen(which should be behavior shown by Screen.clear_widgets()) instead of all screens. I can delete all screens but that would mean doing screenmanager.current = None which is not possible, so should I instead remove the screenmanager after creating one identical to it(identical except the screens).