Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 754
The Dev Avatar asked Oct 27 '25 09:10

The Dev


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.

like image 69
John Anderson Avatar answered Oct 29 '25 22:10

John Anderson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!