Reputation: 63
I'm new in plyer and kivy. I would open a filechooser window when a button is clicked. The problems is: on click of button the window appear but first send None as selection. Here my code:
`def select_path(self, path): if path is not None:
print("Ecco",path)
pass
else:
print("Ok",path)
def file_manager_open(self):
path = filechooser.open_file(title='ciao')
path = str(path)
print("Percorso:",path)
self.select_path(path)`
And here my button code:
MDIconButton: icon:"table-arrow-right" pos_hint:{"center_x":0.1,"center_y":0.9} on_release:app.file_manager_open()
Upvotes: 1
Views: 617
Reputation: 48
The problem is with your syntax, You have to set a callback function for the filechooser this way
def parseChoice(file_paths:list):
print('File path ', file_paths[0])
filechooser.open_file(on_selection=parseChoice)
Upvotes: 0