Essentially every problem I am having seems to boil down to the same problem. I can’t find the information or examples I need to do things.
The latest case is wx.ListCtrl. I simply want to show a list of records (rows and columns) and allow the user to edit fields. I can display the records and I can edit the fields but I don’t know how to get feedback on what was edited. The examples I have been able to find are either
- For much older versions of wxPython/Python that no longer run
- Include so many extra features that the simple example is obscured beyond recognition
- Do not go far enough (ie allow editing but no feedback)
- Omit details necessary to create fully functioning code
For example, I want to provide a handler for the textedit mixin so that I can do processing on begin and end edit. On the begin edit I could save the values of event.m_row and event.m_col so that on end edit I could update any internal data structures. The examples I have seen say this can be done in OnEditBegin and OnEditEnd but do not say what events to use to connect those handlers. One example says to use wx.EVT_LIST_BEGIN_LABEL_EDIT, but this results only in
AttributeError: 'ListEvent' object has no attribute 'm_row'
I saw one suggestion from Robin that I should be using ObjectListView. I tried this, but first had to spend several hours patching the code just to get the examples working (they have not been updated since 2008). When I tried to add editing I found the documentation similarly lacking in sufficient details. This is unfortunate because I especially liked the GroupListView capability. As is typical in wxPython it seems that I need to be proficient enough to not need the documentation in order for the documentation to make sense. A definite catch-22.
But I digress.
How can I connect begin-edit and end-edit handlers so that I can add custom code to identify the row and column being edited?