2

What I want to do is to view all the folder name in the text-field from a specific location. For example, the given data path is-

android/data/

Here, inside data path we have some folders like com.facebook.katana, com.android.browser, com.android.calendar etc. Now what I want to do is to show all the folder names in a the text-field. Is there any way to do that?

Shiam
  • 21
  • 3

1 Answers1

0

The solution/hint is as follow.

Snippet

<FileList>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        FileChooserListView:
            id: filechooser
            path: './'    # 'android/data'
            filters: ['com.*']

FileChooser » path

path

path is a StringProperty and defaults to the current working directory as a unicode string. It specifies the path on the filesystem that this controller should refer to.

Warning

If a unicode path is specified, all the files returned will be in unicode, allowing the display of unicode files and paths. If a bytes path is specified, only files and paths with ascii names will be displayed properly: non-ascii filenames will be displayed and listed with questions marks (?) instead of their unicode characters.

FileChooser » filters

filters

filters specifies the filters to be applied to the files in the directory. filters is a ListProperty and defaults to []. This is equivalent to ‘*’ i.e. nothing is filtered.

The filters are not reset when the path changes. You need to do that yourself if desired.

There are two kinds of filters: patterns and callbacks.

Patterns

e.g. [‘*.png’]. You can use the following patterns:

Pattern Meaning * matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any character not in seq

Callbacks

You can specify a function that will be called for each file. The callback will be passed the folder and file name as the first and second parameters respectively. It should return True to indicate a match and False otherwise.

ikolim
  • 15,721
  • 2
  • 19
  • 29