'On_click event on a TwoLineIconListItem in kivy

I have an array of values . I have to show this list in a TwoLineIconListItem in kivy along with an image icon and with other information in a list view. When the user clicks on any of the list item, a popup should come (preferably a dialog) and I have to show the item text selected...Pls do help !!

I could write everything but it seems like I am unable to pass the value to the dialog from my TwoLineIconListItem...the code snippet is here where I need some help to achieve this please...

while counter < len(list_of_names):
    self.party_name = list_of_names[counter]
    self.party_pic = IconLeftWidget(icon=image_source + "\\" + list_of_names[counter].lower() + ".png")
    counter += 1
    items = TwoLineIconListItem(text=str(counter) + " : " + self.party_name,
                                  secondary_text=self.party_name_details,
                                  on_release=self.select_item)
    items.add_widget(self.party_pic)
    list_view.add_widget(items)

screen.add_widget(scroll)
return screen


def select_item(self, obj):
    print(obj) 

    # It's should print the item text selected
    close_btn = MDFlatButton(text="Close", on_release=self.close_dialog)
    confirm_btn = MDFlatButton(text="I Confirm !", on_release=self.confirm_choice)
    self.dialog = MDDialog(title="Please confirm your choice!",
                           text=self.party_name,
                           size_hint=(0.7, 1),
                           buttons=[close_btn, confirm_btn]
                           )
    self.dialog.open()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source