wxPython - How to add sorting to a ListCtrl?

kyosohma at gmail.com kyosohma at gmail.com
Tue Jul 24 19:35:24 CEST 2007


On Jul 24, 11:21 am, Robert Dailey <rcdai... at gmail.com> wrote:
> Hi,
>
> I have 3 columns in my list control, each with a different "type" of
> data (for example, one column has names, the other has dates, etc).
> Can anyone reference a tutorial for solving this issue? I've done my
> share of googling to no avail. I need the user to be able to click any
> of the column headers and sort the rows of data by that column in
> ascending or descending order.
>
> Thanks for your time.

Look at the wxPython demo. If you look at the list control's demo
code, you'll see they're using a mixin called "ColumnSorterMixin" that
will do what you need.

The demo can be found here: http://www.wxpython.org/download.php

Mike




More information about the Python-list mailing list