in my wxPython app I have a wxListCtrl which I populate with some data. Is there a way I can then use the ListCtrl row items to create a dictionary variable
say my list control has 4 rows in it with columns:- Rush(y/n), Subject, ReceivedDateTime
I want to create a dictionary variable like below:-
mydata = {
1 : ("Y", "Subject1", "datetime1"),
2 : ("N", "Subject2", "Datetime2"),
3 : ("N", "Subject3", "datetime3"),
4 : ("Y", "Subject4", "Datetime4")
}
Just loop through the rows, and retrieve the data as in:
def get_dict(self):
data = {}
count = self.list_ctrl.GetItemCount()
for row in range(count):
data[row + 1] = tuple([self.list_ctrl.GetItem(itemId=row, col=c).GetText() for c in range(3)])
return data