Question

I have a bunch of data organized by rows. In the first cell of each row, I want to have a checkbox, so the user can go through and select certain rows.

I know I could make the user use CTRL + click each row, but I rather have checkboxs as this is a feature to be used a lot.

Was it helpful?

Solution

You can use checkboxes for any cell by explicitly setting it up to use wxGridCellBoolRenderer and wxGridCellBoolEditor, but the simplest way to use them is to just use boolean values for the cells in the first column, i.e. define a custom wxGridTable subclass which would return wxGRID_VALUE_BOOL from its GetTypeName() for the first column. Then the checkboxes will be used automatically.

I'm sure you can find some examples in Python as well, but I can only point you to C++ grid sample, which should hopefully translate to Python in a straightforward way.

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