How to get the folder name from internal storage and show it in the text-field?

18 views
Skip to first unread message

mahmud al hasan

unread,
Jul 21, 2018, 6:40:02 AM7/21/18
to Kivy users support
What I want to do is to view the folder name in the text-field from a specific location. For example, the given data path is-
android/data/com.something

Now I want to show 'com.something' in the text-field. Is there any way to do it?

Wim van de Brug

unread,
Jul 21, 2018, 7:23:36 AM7/21/18
to kivy-...@googlegroups.com
Something like this:

>>> import os
>>> p = "android/data/com.something"
>>> file = os.path.basename(p)
>>> file
'com.something'

then you assign file to your text-field variable. For example:

self.my-text-field.text = file

and in your kv file:
my-text-field:my-text-field
TextInput:
id: my-text-field




--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+unsubscribe@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/ecf6825d-84c2-426b-90ac-e6c09bb76127%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mahmud al hasan

unread,
Jul 21, 2018, 7:29:43 AM7/21/18
to Kivy users support
If there multiple folder name on the data path which I want to view?
Reply all
Reply to author
Forward
0 new messages