[wxPython-users] How to update a ListCtrl view
Werner F. Bruhin
werner.bruhin at free.fr
Wed Jul 11 04:56:37 PDT 2007
Hi Johan,
Johan Geldenhuys wrote:
> Hi all,
> I'm new to this forum and it looks like a great resource of knowledge.
>
> I busy with mu first wxPython app and is using wx.ListCtrl to populate
> values for me.
> The information I want to put into the list with 11 columns is coming from a
> dictionary that may have up to 11 keys.
> When the dictionary is updated, I just want to add the new values to my list
> in a new row. The new row must always be on top with the last sequence
> number is the first column.
>
> The problem I have is that I don't know how to build the view in the correct
> way. I only get the sequence number in the first column and the other column
> stay empty.
>
Maybe something along these lines:
x = 0
for item in yourdir:
self.lcItems.InsertStringItem(x, item) # this inserts an
item and sets the label of column 0
self.lcItems.SetStringItem(x, 1, yourdir[item][0]) # this
sets the lable of column 1
....
self.lcItems.SetStringItem(x, 11, yourdir[item][10])
Hope this helps
Werner
More information about the wxpython-users
mailing list