Inheritance diagram for wx.grid.GridTableBase:
The almost abstract base class for grid tables. A grid table is responsible for storing the grid data and, indirectly, grid cell attributes. The data can be stored in the way most convenient for the application but has to be provided in string form to wx.grid.Grid. It is also possible to provide cells values in other formats if appropriate, e.g. as numbers.
This base class is not quite abstract as it implements a trivial strategy for storing the attributes by forwarding it to wx.grid.GridCellAttrProvider and also provides stubs for some other functions. However it does have a number of pure virtual methods which must be implemented in the derived classes.
wx.grid.GridStringTable, wx.grid.PyGridTableBase
Exactly the same as AppendRows but for columns.
Parameters:
Returns:
bool
Append additional rows at the end of the table.
This method is provided in addition to InsertRows as some data models may only support appending rows to them but not inserting them at arbitrary locations. In such case you may implement this method only and leave InsertRows unimplemented.
Parameters:
Returns:
bool
Returns True if the value of the given cell can be accessed as if it were of the specified type.
By default the cells can only be accessed as strings.
Parameters:
Returns:
bool
Note
Note that a cell could be accessible in different ways, e.g. a numeric cell may return true for wx.grid.GRID_VALUE_NUMBER but also for wx.grid.GRID_VALUE_STRING indicating that the value can be coerced to a string form.
Returns True if this table supports attributes or False otherwise.
By default, the table automatically creates a wx.grid.GridCellAttrProvider when this function is called if it had no attribute provider before and returns True.
Returns:
bool
Returns True if the value of the given cell can be set as if it were of the specified type.
Parameters:
Returns:
bool
See also
Clear the table contents.
Modifying the table structure.
Notice that none of these functions are pure virtual as they don’t have to be implemented if the table structure is never modified after creation, i.e. neither rows nor columns are never added or deleted but that you do need to implement them if they are called, i.e. if your code either calls them directly or uses the matching wx.grid.Grid methods, as by default they simply do nothing which is definitely inappropriate.
This method is used by wx.grid.Grid.ClearGrid.
Exactly the same as DeleteRows but for columns.
Parameters:
Returns:
bool
Delete rows from the table.
Parameters:
Returns:
bool
Return the attribute for the given cell.
By default forwarded to wx.grid.GridCellAttrProvider if any. May be overridden to handle attributes directly in the table.
Parameters:
Returns:
Get the currently used attr provider (may be None).
This function may return None if the attribute provider hasn’t been neither associated with this table by SetAttrProvider nor created on demand by any other methods.
Returns:
wx.grid.GridCellAttrProvider
Return the label of the specified column.
Parameters:
Returns:
string
Must be overridden to return the number of columns in the table.
Returns:
int
Must be overridden to return the number of rows in the table.
Returns:
int
Return the label of the specified row.
By default the numbers are used for labeling rows and Latin letters for labeling columns. If the table has more than 26 columns, the pairs of letters are used starting from the 27-th one and so on, i.e. the sequence of labels is A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ZZ, AAA, ...
Parameters:
Returns:
string
Returns the type of the value in the given cell.
By default all cells are strings and this method returns wx.grid.GRID_VALUE_STRING.
Parameters:
Returns:
string
Must be overridden to implement accessing the table values as text.
Parameters:
Returns:
string
Returns the value of the given cell as a boolean.
This should only be called if CanGetValueAs returns True when called with wx.grid.GRID_VALUE_BOOL argument.
Default implementation always return False.
Parameters:
Returns:
bool
Returns the value of the given cell as a double.
This should only be called if CanGetValueAs returns True when called with wx.grid.GRID_VALUE_FLOAT argument.
Default implementation always return 0.0.
Parameters:
Returns:
double
Returns the value of the given cell as a long integer.
This should only be called if CanGetValueAs returns True when called with wx.grid.GRID_VALUE_NUMBER argument.
Default implementation always return 0.
Parameters:
Returns:
long
Exactly the same as InsertRows but for columns.
Parameters:
Returns:
bool
Insert additional rows at the end of the table.
Parameters:
Returns:
bool
Must be overridden to implement testing for empty cells.
Parameters:
Returns:
bool
Set attribute of the specified cell.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetAttr.
The table takes ownership of attr, i.e. will call DecRef() on it.
Parameters:
Attributes management.
By default the attributes management is delegated to wx.grid.GridCellAttrProvider class. You may override the methods in this section to handle the attributes directly if, for example, they can be computed from the cell values. Associate this attributes provider with the table.
The table takes ownership of attrProvider pointer and will delete it when it doesn’t need it any more. The pointer can be None, however this won’t disable attributes management in the table but will just result in a default attributes being recreated the next time any of the other functions in this section is called. To completely disable the attributes support, should this be needed, you need to override CanHaveAttributes to return False.
Parameters:
Set attribute of the specified column.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetColAttr.
The table takes ownership of attr, i.e. will call DecRef() on it.
Parameters:
Exactly the same as SetRowLabelValue but for columns.
Parameters:
Set attribute of the specified row.
By default this function is simply forwarded to wx.grid.GridCellAttrProvider.SetRowAttr.
The table takes ownership of attr, i.e. will call DecRef() on it.
Parameters:
Set the given label for the specified row.
The default version does nothing, i.e. the label is not stored.
You must override this method in your derived class if you wish wx.grid.Grid.SetRowLabelValue to work.
Parameters:
Must be overridden to implement setting the table values as text.
Parameters:
Sets the value of the given cell as a boolean.
This should only be called if CanSetValueAs returns True when called with wx.grid.GRID_VALUE_BOOL argument.
Default implementation doesn’t do anything.
Parameters:
Sets the value of the given cell as a double.
This should only be called if CanSetValueAs returns True when called with wx.grid.GRID_VALUE_FLOAT argument.
Default implementation doesn’t do anything.
Parameters:
Sets the value of the given cell as a long integer.
This should only be called if CanSetValueAs returns True when called with wx.grid.GRID_VALUE_NUMBER argument.
Default implementation doesn’t do anything.
Parameters:
Called by the grid when the table is associated with it.
The default implementation stores the pointer and returns it from its GetView and so only makes sense if the table cannot be associated with more than one grid at a time.
Overriding this method is optional.
Parameters: