Defining and Loading Data in wx.ListCtrl

Hi,

What you are doing is inserting the columns themselves and that looks right

to me. To actually insert rows, you normally use InsertStringItem (or

similar) for the first item in the row and then SetStringItem for the other

columns in that row.

Mike,

Gotcha’. I missed this reading the ListCtrl chapter in the book. Can I use

a dictionary holding all rows to load the list control?

You can use any data structure you want to use if you’re careful. Look at the demo. It uses a dictionary.

I wrote about some of this stuff here:

http://www.blog.pythonlibrary.org/2011/01/04/wxpython-wx-listctrl-tips-and-tricks/

This is very helpful. Thanks. I notice on your example (like on my efforts

so far) that there’s an extra column on the right side. Is that column

always present or can it be eliminated with some ListCtrl foo?

Yeah, you can can. I don’t know why I didn’t mention it in that article, but you just need to use the ListCtrlAutoWidthMixin. There’s an example of that in the demo too.

Personally, I prefer the ObjectListView wrapper over the wx.ListCtrl, but

I’ve used both.

I’ll look at this, too. The applications I develop are few and far between

so I end up relearning each time.

Very much appreciated,

Rich

No problem.

···

On Tue, Dec 13, 2011 at 8:42 AM, Rich Shepard rshepard@appl-ecosys.com wrote:

On Mon, 12 Dec 2011, Mike Driscoll wrote:


Mike Driscoll

Blog: http://blog.pythonlibrary.org