4

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?

The Dev
  • 65
  • 5

2 Answers2

6

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.

John Anderson
  • 35,991
  • 4
  • 13
  • 36
  • Good solution/work around! Using Kivy 2.0.0 and all other solutions on stack use deprecated functions such as `listadapters` and `listviews`. – Binx Dec 14 '21 at 16:43
3

The best solution I found is Kivy's Garden FileBrowser widget:

https://github.com/kivy-garden/garden.filebrowser

Which produces the following layout:

enter image description here

kelkka
  • 874
  • 7
  • 18