MDList - OneLineAvatarIconListItem usage problem

38 views
Skip to first unread message

so cool

unread,
Jul 2, 2022, 5:47:10 AM7/2/22
to Kivy users support
Hi I'm trying to create a multiline list using "MDList" and "OneLineAvatarIconListItem" but I'm having trouble and don't know how to get the widget's id. In the picture, I exemplify a wrong rendering.

THANKS !

无标题.png

satyam yadav

unread,
Jul 2, 2022, 6:56:57 AM7/2/22
to Kivy users support
try printing(self.ids)

Elliot Garbus

unread,
Jul 2, 2022, 8:35:07 AM7/2/22
to kivy-...@googlegroups.com

The id is not a kivy property.  The id is a kv language construct. When kv is compiled a dictionary is created named ids, the keys in the dict are the id identifiers, the associated value is the widget the key refers to.  As suggested, print self.ids to see the id list.  Here is a description from the docs: https://kivy.org/doc/stable/api-kivy.lang.html?highlight=kivy%20lang#ids

 

In your example you can access the attributes of the widget, in Click_button(), you could print(button.text)

If you wanted to create an identifier that was not visible on screen, you could add a property to the widget and use that to hold a custom identifier – but you can not all it “id”. 

 

You can also see a list of all of the children of the MDList by using the children attribute of the MDList.


--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/da8594fa-a460-47ea-a472-e0e76eff4d7dn%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages