Python create dictionary type variable out of row items in wxListCtrl
<p>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</p>

<p>say my list control has 4 rows in it with columns:- Rush(y/n), Subject, ReceivedDateTime</p>

<p>I want to create a dictionary variable like below:-</p>

<pre><code>mydata = {
1 : ("Y", "Subject1", "datetime1"),
2 : ("N", "Subject2", "Datetime2"),
3 : ("N", "Subject3", "datetime3"),
4 : ("Y", "Subject4", "Datetime4")
}
</code></pre>

<p>Just loop through the rows, and retrieve the data as in:</p>

<pre><code>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
</code></pre>

python dictionary wxpython listctrl