[wxPython] how to know the column I clicked in a wxListCtrl

My aim is to know which column header I've clicked, but after
several attempts I decided to ask for help.

Here is my latest attempt:

listeId = NewId()
self.liste = wxListCtrl (self.panel, listeId, wxPoint(0, 0),
wxSize(760, 370), wxLC_REPORT)

self.liste.InsertColumn (0, 'Raison sociale')
self.liste.InsertColumn (1, 'Commune')
self.liste.InsertColumn (2, 'Camions')
self.liste.InsertColumn (3, 'Zone')
self.liste.InsertColumn (4, 'Mo seul')
self.liste.InsertColumn (5, 'Pr seul')
self.liste.InsertColumn (6, 'Mo +prox')
self.liste.InsertColumn (7, 'Pr +prox')
self.liste.InsertColumn (8, 'Décision')
self.liste.SetColumnWidth(0, 120)
self.liste.SetColumnWidth(1, 100)
self.liste.SetColumnWidth(2, 55)
self.liste.SetColumnWidth(3, 90)
self.liste.SetColumnWidth(4, 70)
self.liste.SetColumnWidth(5, 80)
self.liste.SetColumnWidth(6, 85)
self.liste.SetColumnWidth(7, 85)
self.liste.SetColumnWidth(8, 60)
        
self.propriete = wxListItem()

EVT_LIST_COL_CLICK(self.liste, listeId, self.OnColumnSelected)

def OnColumnSelected(self, event):
     print 'OnColumnSelected'
     for i in range(0, 8):
         if self.liste.GetColumn(i, self.propriete) == true:
            print self.propriete.m_state
            print 'column %s selected' %i

pfo@informactis.com wrote:

My aim is to know which column header I've clicked, but after
several attempts I decided to ask for help.

[...]

EVT_LIST_COL_CLICK(self.liste, listeId, self.OnColumnSelected)

def OnColumnSelected(self, event):
     print 'OnColumnSelected'
     for i in range(0, 8):
         if self.liste.GetColumn(i, self.propriete) == true:
            print self.propriete.m_state
            print 'column %s selected' %i

In this event, event.m_col refers to the column that was clicked.

···

--
Riaan >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net