У меня есть папка "music" в ней хранится музыка, как вывести список этих файлов в KivyMD?
Вот сам код
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.audio import SoundLoader
from kivymd.uix.list import OneLineListItem
from video_converter import download_from_youtube
from vk_music import vk_music_get
import os
class Test(MDApp):
def build(self):
self.theme_cls.primary_palette = "Gray"
return Builder.load_string(
'''
#:import Window kivy.core.window.Window
#:import IconLeftWidget kivymd.uix.list.IconLeftWidget
#:import images_path kivymd.images_path
BoxLayout:
orientation:'vertical'
font_style: "Sans"
background: "Dark"
MDToolbar:
title: 'My Archive'
md_bg_color: .2, .2, .2, 1
specific_text_color: 1, 1, 1, 1
icon: 'music'
MDBottomNavigation:
panel_color: .2, .2, .2, 1
MDBottomNavigationItem:
name: 'music screen'
text: 'Music'
icon: 'music'
ScrollView:
MDList:
id: scroll
MDBottomNavigationItem:
name: 'download screen'
text: 'YT Download'
icon: 'youtube'
MDLabel:
MDTextField:
id: YT_URL
hint_text: "Enter URL from YouTube"
color_mode: 'accent'
width: "500dp"
pos: 0,100
MDIconButton:
id: button_check
icon: "download_icon.png"
user_font_size: "32sp"
set_pos_bottom_buttons: "right"
pos: 0,5
on_press: app.yt_implement()
active: False
MDSpinner:
size_hint: None, None
size: dp(46), dp(46)
pos_hint: {'center_x': .5, 'center_y': .5}
active: True if button_check.active else False
MDBottomNavigationItem:
name: 'download screen VK'
text: 'VK download'
icon: "vk_icon.png"
MDLabel:
MDTextField:
id: vk_login
hint_text: "Enter login"
color_mode: 'accent'
width: "500dp"
pos: 0,300
MDTextField:
id:vk_password
hint_text: "Enter password"
color_mode: 'accent'
width: "500dp"
pos: 0,200
MDIconButton:
icon: "download_icon.png"
user_font_size: "32sp"
pos: 0,5
on_press: app.VK_implement()
''')
def yt_implement(self):
print('YouTube download processing... ==>')
self.yt_url = str(self.root.ids.YT_URL.text)
download_from_youtube(self.yt_url)
def VK_implement(self):
print('VK download processing... ==>')
self.vk_login = (str(self.root.ids.vk_login.text))
self.vk_password = (str(self.root.ids.vk_password.text))
vk_music_get(self.vk_login, self.vk_password)
# Вот тут думал как нибудь реализовать вывод файлов, но ничего не придумал.
def show_ellements(self):
pass
Test().run()