Thanks for your response,ZenCODE.
I've modified my code with your suggestion.
It looks like:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.recycleview import RecycleView
from kivy.uix.boxlayout import BoxLayout
from pymongo import MongoClient, ASCENDING
from kivy.properties import StringProperty
class WID(BoxLayout):
text = StringProperty()
Builder.load_string('''
<WID>:
AsyncImage:
source: 'to_define'
Label:
text :root.text
<RV>:
viewclass: 'WID'
RecycleBoxLayout:
default_size: None, dp(56)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
''')
class RV(RecycleView):
def __init__(self, **kwargs):
super(RV, self).__init__(**kwargs)
client = MongoClient()
db = client.player
mf = db.mediafiles
key = "album"
cursor = mf.find({'$and': [{}, {'album': {'$exists': True}}]}).sort(key, ASCENDING).distinct(key)
self.data = [{'text': str(x)} for x in cursor]
class TestApp(App):
def build(self):
return RV()
if __name__ == '__main__':
TestApp().run()
The display is no more slow but immediate.
BUT it's basically a better ListView and I cannot have a nice arrangement of my widgets with it: one widget is under he other, taking the whole screen width.
So, I suppose I must decide adopting this solution OR leaving my app. as it is (and adding a pagination when the items or too numerous ... )
It seem's that there is no way to have the speed AND the beauty (staskLayout) at the same time.
Best regards