OriolAnd
OriolAnd

Reputation: 13

How to capture clicks on header in wxPython grids

I am trying to sort columns in wxPython grids and for that I want to run a function when there is a left click in a column header. Now what is the right hierarchy to process the event and how would you run the function once it happens?

The class HeaderCtrl has the method EVT_HEADER_CLICK, but how can I include this method in my binds?

self.Bind(wx.EVT_HEADER_CLICK,self.sortData)

Upvotes: 0

Views: 568

Answers (2)

brettb
brettb

Reputation: 809

I think you want to use the wx.Grid.EVT_GRID_LABEL_LEFT_CLICK event.

See: http://www.blog.pythonlibrary.org/2010/04/04/wxpython-grid-tips-and-tricks/

Upvotes: 1

user2963623
user2963623

Reputation: 2295

Try

self.grid.Bind(wx.EVT_HEADER_CLICK,self.sortData)

Upvotes: 0

Related Questions