0
votes

How can I append row and it's corresponding data into ListCtrl. I've just finished how to use TreeCtrl(Relatively easier than ListCtrl), it shows me a clear usage of matching single GUI object and data. But ListCtrl dose not.

  1. How can I append or insert single row with it's corresponding data.
  2. How can I access row and it's data
  3. How can I manipulated them (Editing data/row, Deleting data/row)

Can you explain summary of them? Thank you. I know my question is so simple and I can get about this from doc somewhat. I read docs, but still I got no clue

1
your question is too broad. Besides on Stackoverflow you should show your code , full error message and then we can try to resolve this problem.furas
This is a request for a full tutorial rather than a questionRolf of Saxony

1 Answers

1
votes

I know that wxPython docs are retarded and gives no much help, here is some quick tips below, i added explanations in comments:

# create new list control
listctrl = wx.dataview.DataViewListCtrl( my_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.dataview.DV_SINGLE )

# setup listctrl columns
listctrl.AppendTextColumn('first name', width=220)  # normal text column
listctrl.AppendBitmapColumn('my images', 0, width=35)  # you can add images in this col
listctrl.AppendProgressColumn('Progress', align=wx.ALIGN_CENTER)  # a progress bar

listctrl.SetRowHeight(30)  # define all rows height

# add data, note myList is a list or tuple contains the exact type of data for each columns and same length as col numbers
listctrl.AppendItem(myList)

# to modify an entry "a single cell located at row x col"
listctrl.SetValue(myNewValue, row, column)