How to access all Harddrives in kivy FileChooser Python
Question:
how can I display all harddrives installed in the System (C,X,J) in a kivy FileChooser using either Listview or Iconview in kivy 1.11.1?
Answers:
I faced the same problem and finally solved it by adding "shortcut" buttons for the drives. I start by getting a list of all the drives using:
drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
Then creating a Button
for each drive, with the on_release
bound to an open_entry()
method. The open_entry()
method creates a fake Entry
and calls the FileChooser
open_entry()
method.
The best solution I found is Kivy’s Garden FileBrowser widget:
https://github.com/kivy-garden/garden.filebrowser
Which produces the following layout:
how can I display all harddrives installed in the System (C,X,J) in a kivy FileChooser using either Listview or Iconview in kivy 1.11.1?
I faced the same problem and finally solved it by adding "shortcut" buttons for the drives. I start by getting a list of all the drives using:
drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
Then creating a Button
for each drive, with the on_release
bound to an open_entry()
method. The open_entry()
method creates a fake Entry
and calls the FileChooser
open_entry()
method.
The best solution I found is Kivy’s Garden FileBrowser widget:
https://github.com/kivy-garden/garden.filebrowser
Which produces the following layout: