I have this code. Can Someone help me with an If statement
or any code that can call on_release
event to create a new Tab.
def load_songs(self, storageLocation):
songs = []
if Path('Books').is_dir():
for filename in storageLocation.glob('**/*.wav'):
songs.append(filename)
# Create subfolder(Chapter)
booksdir = [f for f in storageLocation.iterdir() if f.is_dir()]
for value, Bookfolders in enumerate(booksdir):
#create OneLineListItem(or Button) for each subfolder
self.root.ids.Books.add_widget(OneLineListItem(text=str(Bookfolders), pos_hint={"center_x": 1, "center_y": 1}, ))
> #Here I want a statement that would create a new Tab using the line below whenever the OneLineListItem above is clicked I also intend to close it whenever the user leaves the Tab.
self.root.ids.tabs.add_widget(Tab(title="yea",))