Kivy - python - multiple widgets in recycleview row(Kivy - python - recycleview 行中的多个小部件)
问题描述
I would like to make a recycleview that has multiple labels in each recycleview row. In my specfic example I would like to have 3 labels in each row: 1 label containing the item index, one label containing an item from one dataset, and another label from another dataset
In this example (taken from the kivy examples) we have a recycleview where each row in the recycleview contains a single label:
I would like each recycleview row to have 3 labels: first label is the index, second label is items_1 and third label is items_2. Like this:
0 apple dog
1 banana cat
2 pear rat
3 pineapple bat
Thank you!
I was looking for a similar solution and could not find it. I do not think PalimPalim has really answered the question since I think the Ben t was looking for multiple label widgets treated as a single line.
In this case you use a custom widget for GridLayout and specify it's structure.
In applying your data into the RV, you will need to restructure the dictionary to reflect the label layout
Finally in the refresh_view_attrs, you will specify .label_text which is bound to each label, or you can use label id's.
The entire code is below:
这篇关于Kivy - python - recycleview 行中的多个小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!