Search code examples
pythonkivyfilechooser

How to access all Harddrives in kivy FileChooser Python


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?


Solution

  • 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.