Search code examples
pythonimagefile-uploadkivyandroid-gallery

Python Kivy select images from gallery


Is it possible to load images from the gallery in a Kivy application?

On the Internet I found only a filechooser for all directories on the device. But I need a button, and when you click it, it opens menu where you select source. Like this.

Is it even possible on Kivy?


Solution

  • Good day. The scope of your question is very big so I will give you the highlights on what to do.

    1. Find the directory path of pictures on your system device.
    2. Under the FileChooser, set rootpath = photos_directory_path
    3. For button: assign a button callback method to open the filechooser at the directory. you could put the file chooser in a popup widget. Her is an example in kvlang
    <FileChooserPopup@Popup>:
        FileChooser:
            rootpath:app.photos_directory_path
    
    GridLayout: #your sliding-up interface
        Button:
            on_release: Factory.FileChooserPopup.open(root)