from kivymd.uix.dialog2 import ListMDDialog class TreePopupMenu(ListMDDialog): def __init__(self, tree_data): super().__init__() # Set all of the fields of tree data headers = "Name,Lat,Lon,Description" headers = headers.split(',') for i in range(len(headers)): attribute_name = headers[i] attribute_value = tree_data[i] setattr(self, attribute_name, attribute_value)