Question

I've written code for ListCtrl in wxPython:

List Control

...
self.list_ctrl = wx.ListCtrl(panel, size=(-1,150), style=wx.LC_REPORT|wx.BORDER_SUNKEN)
self.list_ctrl.InsertColumn(0, 'Name')
self.list_ctrl.InsertColumn(1, 'Old value')
self.list_ctrl.InsertColumn(2, 'New value')
self.list_ctrl.InsertColumn(3, 'Old percent')
self.list_ctrl.InsertColumn(4, 'New percent')
...

But I want to get the ListCtrl (or another widget) with following headers organization:

Headers organization

I think that It hardy to solve this problem using ListCtrl, may be use another widget in wxPython?

Was it helpful?

Solution

As I pointed out on the wxPython mailing list where you cross-posted, the ListCtrl does not offer this capability. You might be able to do this with the Grid control (wx.grid.Grid) using column spanning techniques and your own sorting algorithms. You may be able to hack UltimateListCtrl to do this since it's pure Python instead of a wrapped C++ object, but that will be a non-trivial patch / hack.

Probably the best approach would be to roll your own widget. There are examples of custom widgets in the wxPython wiki, the wxPython demo and on their mailing list.

OTHER TIPS

Well you can make your own widget using wx.html.HtmlWindow widget. Here is the sample link: http://zetcode.com/wxpython/advanced/.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top