phoenix_title wx.grid.Grid

wx.grid.Grid and its related classes are used for displaying and editing tabular data.

They provide a rich set of features for display, editing, and interacting with a variety of data sources. For simple applications, and to help you get started, wx.grid.Grid is the only class you need to refer to directly. It will set up default instances of the other classes and manage them for you. For more complex applications you can derive your own classes for custom grid views, grid data tables, cell editors and renderers. The Grid Overview has examples of simple and more complex applications, explains the relationship between the various grid classes and has a summary of the keyboard shortcuts and mouse functions provided by wx.grid.Grid.

A wx.grid.GridTableBase class holds the actual data to be displayed by a wx.grid.Grid class. One or more wx.grid.Grid classes may act as a view for one table class. The default table class is called wx.grid.GridStringTable and holds an array of strings. An instance of such a class is created by CreateGrid.

wx.grid.GridCellRenderer is the abstract base class for rendering contents in a cell. The following renderers are predefined:

The look of a cell can be further defined using wx.grid.GridCellAttr. An object of this type may be returned by wx.grid.GridTableBase.GetAttr .

wx.grid.GridCellEditor is the abstract base class for editing the value of a cell. The following editors are predefined:

Please see wx.grid.GridEvent, wx.grid.GridSizeEvent, wx.grid.GridRangeSelectEvent, and wx.grid.GridEditorCreatedEvent for the documentation of all event types you can use with wx.grid.Grid.


class_hierarchy Class Hierarchy

Inheritance diagram for class Grid:

method_summary Methods Summary

__init__

Default constructor.

AppendCols

Appends one or more new columns to the right of the grid.

AppendRows

Appends one or more new rows to the bottom of the grid.

AreHorzGridLinesClipped

Return True if the horizontal grid lines stop at the last column boundary or False if they continue to the end of the window.

AreVertGridLinesClipped

Return True if the vertical grid lines stop at the last row boundary or False if they continue to the end of the window.

AssignTable

Assigns a pointer to a custom grid table to be used by the grid.

AutoSize

Automatically sets the height and width of all rows and columns to fit their contents.

AutoSizeColLabelSize

Automatically adjusts width of the column to fit its label.

AutoSizeColumn

Automatically sizes the column to fit its contents.

AutoSizeColumns

Automatically sizes all columns to fit their contents.

AutoSizeRow

Automatically sizes the row to fit its contents.

AutoSizeRowLabelSize

Automatically adjusts height of the row to fit its label.

AutoSizeRows

Automatically sizes all rows to fit their contents.

BeginBatch

Increments the grid’s batch count.

BlockToDeviceRect

Convert grid cell coordinates to grid window pixel coordinates.

CalcCellsExposed

Appends one or more new columns to the right of the grid.

CalcColLabelsExposed

Appends one or more new columns to the right of the grid.

CalcGridWindowScrolledPosition

Translates the logical coordinates to the device ones, taking into account the grid window type.

CalcGridWindowUnscrolledPosition

Translates the device coordinates to the logical ones, taking into account the grid window type.

CalcRowLabelsExposed

Appends one or more new columns to the right of the grid.

CanDragCell

Return True if the dragging of cells is enabled or False otherwise.

CanDragColMove

Returns True if columns can be moved by dragging with the mouse.

CanDragColSize

Returns True if the given column can be resized by dragging with the mouse.

CanDragGridSize

Return True if the dragging of grid lines to resize rows and columns is enabled or False otherwise.

CanDragRowSize

Returns True if the given row can be resized by dragging with the mouse.

CanEnableCellControl

Returns True if the in-place edit control for the current grid cell can be used and False otherwise.

CanHaveAttributes

Returns True if this grid has support for cell attributes.

CanHideColumns

Returns True if columns can be hidden from the popup menu of the native header.

CellToGridWindow

Returns the grid window that contains the cell.

CellToRect

Return the rectangle corresponding to the grid cell’s size and position in logical coordinates.

ClearGrid

Clears all data in the underlying grid table and repaints the grid.

ClearSelection

Deselects all cells that are currently selected.

ClipHorzGridLines

Change whether the horizontal grid lines are clipped by the end of the last column.

ClipVertGridLines

Change whether the vertical grid lines are clipped by the end of the last row.

Create

Creates the grid window for an object initialized using the default constructor.

CreateGrid

Creates a grid with the specified initial number of rows and columns.

DeleteCols

Deletes one or more columns from a grid starting at the specified position.

DeleteRows

Deletes one or more rows from a grid starting at the specified position.

DeselectCell

Deselects a cell.

DeselectCol

Deselects a column of cells.

DeselectRow

Deselects a row of cells.

DevicePosToGridWindow

Returns the grid window that includes the input coordinates.

DisableCellEditControl

Disables in-place editing of grid cells.

DisableColResize

Disable interactive resizing of the specified column.

DisableDragColMove

Disables column moving by dragging with the mouse.

DisableDragColSize

Disables column sizing by dragging with the mouse.

DisableDragGridSize

Disable mouse dragging of grid lines to resize rows and columns.

DisableDragRowSize

Disables row sizing by dragging with the mouse.

DisableHidingColumns

Disables column hiding from the header popup menu.

DisableRowResize

Disable interactive resizing of the specified row.

DrawCellHighlight

DrawColLabel

DrawColLabels

DrawCornerLabel

DrawRowLabel

DrawRowLabels

DrawTextRectangle

EnableCellEditControl

Enables or disables in-place editing of grid cell data.

EnableDragCell

Enables or disables cell dragging with the mouse.

EnableDragColMove

Enables or disables column moving by dragging with the mouse.

EnableDragColSize

Enables or disables column sizing by dragging with the mouse.

EnableDragGridSize

Enables or disables row and column resizing by dragging gridlines with the mouse.

EnableDragRowSize

Enables or disables row sizing by dragging with the mouse.

EnableEditing

Makes the grid globally editable or read-only.

EnableGridLines

Turns the drawing of grid lines on or off.

EnableHidingColumns

Enables or disables column hiding from the header popup menu.

EndBatch

Decrements the grid’s batch count.

Fit

Overridden wx.Window method.

ForceRefresh

Causes immediate repainting of the grid.

FreezeTo

Sets or resets the frozen columns and rows.

GetBatchCount

Returns the number of times that BeginBatch has been called without (yet) matching calls to EndBatch .

GetCellAlignment

Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location.

GetCellBackgroundColour

Returns the background colour of the cell at the specified location.

GetCellEditor

Returns a pointer to the editor for the cell at the specified location.

GetCellFitMode

Returns the cell fitting mode.

GetCellFont

Returns the font for text in the grid cell at the specified location.

GetCellHighlightColour

GetCellHighlightPenWidth

GetCellHighlightROPenWidth

GetCellOverflow

Returns True if the cell value can overflow.

GetCellRenderer

Returns a pointer to the renderer for the grid cell at the specified location.

GetCellSize

Get the size of the cell in number of cells covered by it.

GetCellTextColour

Returns the text colour for the grid cell at the specified location.

GetCellValue

Returns the string contained in the cell at the specified location.

GetClassDefaultAttributes

GetColAt

Returns the column ID of the specified column position.

GetColGridLinePen

Returns the pen used for vertical grid lines.

GetColLabelAlignment

Sets the arguments to the current column label alignment values.

GetColLabelSize

Returns the current height of the column labels.

GetColLabelTextOrientation

Returns the orientation of the column labels (either HORIZONTAL or VERTICAL ).

GetColLabelValue

Returns the specified column label.

GetColLeft

Returns the coordinate of the left border specified column.

GetColMinimalAcceptableWidth

Returns the minimal width to which a column may be resized.

GetColMinimalWidth

Get the minimal width of the given column/row.

GetColPos

Returns the position of the specified column.

GetColRight

Returns the coordinate of the right border specified column.

GetColSize

Returns the width of the specified column.

GetColSizes

Get size information for all columns at once.

GetCornerLabelAlignment

Sets the arguments to the current corner label alignment values.

GetCornerLabelTextOrientation

Returns the orientation of the corner label (either HORIZONTAL or VERTICAL ).

GetCornerLabelValue

Returns the (top-left) corner label.

GetDefaultCellAlignment

Returns the default cell alignment.

GetDefaultCellBackgroundColour

Returns the current default background colour for grid cells.

GetDefaultCellFitMode

Returns the default cell fitting mode.

GetDefaultCellFont

Returns the current default font for grid cell text.

GetDefaultCellOverflow

Returns True if the cells can overflow by default.

GetDefaultCellTextColour

Returns the current default colour for grid cell text.

GetDefaultColLabelSize

Returns the default height for column labels.

GetDefaultColSize

Returns the current default width for grid columns.

GetDefaultEditor

Returns a pointer to the current default grid cell editor.

GetDefaultEditorForCell

Returns the default editor for the specified cell.

GetDefaultEditorForType

Returns the default editor for the cells containing values of the given type.

GetDefaultGridLinePen

Returns the pen used for grid lines.

GetDefaultRenderer

Returns a pointer to the current default grid cell renderer.

GetDefaultRendererForCell

Returns the default renderer for the given cell.

GetDefaultRendererForType

Returns the default renderer for the cell containing values of the given type.

GetDefaultRowLabelSize

Returns the default width for the row labels.

GetDefaultRowSize

Returns the current default height for grid rows.

GetFirstFullyVisibleColumn

Returns the leftmost column of the current visible area.

GetFirstFullyVisibleRow

Returns the topmost row of the current visible area.

GetFrozenColGridWindow

Return the columns grid window containing column frozen cells.

GetFrozenCornerGridWindow

Return the corner grid window containing frozen cells.

GetFrozenRowGridWindow

Return the rows grid window containing row frozen cells.

GetGridColHeader

Return the header control used for column labels display.

GetGridColLabelWindow

Return the column labels window.

GetGridCornerLabelWindow

Return the window in the top left grid corner.

GetGridCursorCol

Returns the current grid cell column position.

GetGridCursorCoords

Returns the current grid cursor position.

GetGridCursorRow

Returns the current grid cell row position.

GetGridLineColour

Returns the colour used for grid lines.

GetGridRowLabelWindow

Return the row labels window.

GetGridWindow

Return the main grid window containing the grid cells.

GetGridWindowOffset

GetLabelBackgroundColour

Returns the colour used for the background of row and column labels.

GetLabelFont

Returns the font used for row and column labels.

GetLabelTextColour

Returns the colour used for row and column label text.

GetNumberCols

Returns the total number of grid columns.

GetNumberFrozenCols

Returns the number of frozen grid columns.

GetNumberFrozenRows

Returns the number of frozen grid rows.

GetNumberRows

Returns the total number of grid rows.

GetOrCreateCellAttr

Returns the attribute for the given cell creating one if necessary.

GetOrCreateCellAttrPtr

Returns the attribute for the given cell creating one if necessary.

GetRowGridLinePen

Returns the pen used for horizontal grid lines.

GetRowLabelAlignment

Returns the alignment used for row labels.

GetRowLabelSize

Returns the current width of the row labels.

GetRowLabelValue

Returns the specified row label.

GetRowMinimalAcceptableHeight

Returns the minimal size to which rows can be resized.

GetRowMinimalHeight

Returns the minimal size for the given column.

GetRowSize

Returns the height of the specified row.

GetRowSizes

Get size information for all row at once.

GetScrollLineX

Returns the number of pixels per horizontal scroll increment.

GetScrollLineY

Returns the number of pixels per vertical scroll increment.

GetSelectedBlocks

Returns a range of grid selection blocks.

GetSelectedCells

Returns an array of individually selected cells.

GetSelectedCols

Returns an array of selected columns.

GetSelectedRows

Returns an array of selected rows.

GetSelectionBackground

Returns the colour used for drawing the selection background.

GetSelectionBlockBottomRight

Returns an array of the bottom right corners of blocks of selected cells.

GetSelectionBlockTopLeft

Returns an array of the top left corners of blocks of selected cells.

GetSelectionForeground

Returns the colour used for drawing the selection foreground.

GetSelectionMode

Returns the current selection mode.

GetSortingColumn

Return the column in which the sorting indicator is currently displayed.

GetTable

Returns a base pointer to the current table object.

GoToCell

Make the given cell current and ensure it is visible.

GridLinesEnabled

Returns True if drawing of grid lines is turned on, False otherwise.

HideCellEditControl

Hides the in-place cell edit control.

HideCol

Hides the specified column.

HideColLabels

Hides the column labels by calling SetColLabelSize with a size of 0.

HideRow

Hides the specified row.

HideRowLabels

Hides the row labels by calling SetRowLabelSize with a size of 0.

InsertCols

Inserts one or more new columns into a grid with the first new column at the specified position.

InsertRows

Inserts one or more new rows into a grid with the first new row at the specified position.

IsCellEditControlEnabled

Returns True if the in-place edit control is currently enabled.

IsCellEditControlShown

Returns True if the in-place edit control is currently shown.

IsColShown

Returns True if the specified column is not currently hidden.

IsCurrentCellReadOnly

Returns True if the current cell is read-only.

IsEditable

Returns False if the whole grid has been set as read-only or True otherwise.

IsInSelection

Returns True if the given cell is selected.

IsReadOnly

Returns True if the cell at the specified location can’t be edited.

IsRowShown

Returns True if the specified row is not currently hidden.

IsSelection

Returns True if there are currently any selected cells, rows, columns or blocks.

IsSortOrderAscending

Return True if the current sorting order is ascending or False if it is descending.

IsSortingBy

Return True if this column is currently used for sorting.

IsUsingNativeHeader

Return True if native header control is currently being used.

IsVisible

Returns True if a cell is either entirely or at least partially visible in the grid window.

MakeCellVisible

Brings the specified cell into the visible grid cell area with minimal scrolling.

MoveCursorDown

Moves the grid cursor down by one row.

MoveCursorDownBlock

Moves the grid cursor down in the current column such that it skips to the beginning or end of a block of non-empty cells.

MoveCursorLeft

Moves the grid cursor left by one column.

MoveCursorLeftBlock

Moves the grid cursor left in the current row such that it skips to the beginning or end of a block of non-empty cells.

MoveCursorRight

Moves the grid cursor right by one column.

MoveCursorRightBlock

Moves the grid cursor right in the current row such that it skips to the beginning or end of a block of non-empty cells.

MoveCursorUp

Moves the grid cursor up by one row.

MoveCursorUpBlock

Moves the grid cursor up in the current column such that it skips to the beginning or end of a block of non-empty cells.

MovePageDown

Moves the grid cursor down by some number of rows so that the previous bottom visible row becomes the top visible row.

MovePageUp

Moves the grid cursor up by some number of rows so that the previous top visible row becomes the bottom visible row.

ProcessTableMessage

Receive and handle a message from the table.

RefreshAttr

Invalidates the cached attribute for the given cell.

RegisterDataType

Register a new data type.

Render

Draws part or all of a wx.grid.Grid on a wx.DC for printing or display.

ResetColPos

Resets the position of the columns to the default.

SaveEditControlValue

Sets the value of the current grid cell to the current in-place edit control value.

SelectAll

Selects all cells in the grid.

SelectBlock

Selects a rectangular block of cells.

SelectCol

Selects the specified column.

SelectRow

Selects the specified row.

SetAttr

Sets the cell attributes for the specified cell.

SetCellAlignment

Sets the horizontal and vertical alignment for grid cell text at the specified location.

SetCellBackgroundColour

Set the background colour for the given cell or all cells by default.

SetCellEditor

Sets the editor for the grid cell at the specified location.

SetCellFitMode

Specifies the behaviour of the cell contents if it doesn’t fit into the available space.

SetCellFont

Sets the font for text in the grid cell at the specified location.

SetCellHighlightColour

SetCellHighlightPenWidth

SetCellHighlightROPenWidth

SetCellOverflow

Sets the overflow permission of the cell.

SetCellRenderer

Sets the renderer for the grid cell at the specified location.

SetCellSize

Set the size of the cell.

SetCellTextColour

Sets the text colour for the given cell.

SetCellValue

Sets the string value for the cell at the specified location.

SetColAttr

Sets the cell attributes for all cells in the specified column.

SetColFormatBool

Sets the specified column to display boolean values.

SetColFormatCustom

Sets the specified column to display data in a custom format.

SetColFormatDate

Sets the specified column to display date values.

SetColFormatFloat

Sets the specified column to display floating point values with the given width and precision.

SetColFormatNumber

Sets the specified column to display integer values.

SetColLabelAlignment

Sets the horizontal and vertical alignment of column label text.

SetColLabelSize

Sets the height of the column labels.

SetColLabelTextOrientation

Sets the orientation of the column labels (either HORIZONTAL or VERTICAL ).

SetColLabelValue

Set the value for the given column label.

SetColMinimalAcceptableWidth

Sets the minimal width to which the user can resize columns.

SetColMinimalWidth

Sets the minimal width for the specified column col.

SetColPos

Sets the position of the specified column.

SetColSize

Sets the width of the specified column.

SetColSizes

Restore all columns sizes.

SetColumnsOrder

Sets the positions of all columns at once.

SetCornerLabelAlignment

Sets the horizontal and vertical alignment of the (top-left) corner label text.

SetCornerLabelTextOrientation

Sets the orientation of the (top-left) corner label (either HORIZONTAL or VERTICAL ).

SetCornerLabelValue

Set the value for the (top-left) corner label.

SetDefaultCellAlignment

Sets the default horizontal and vertical alignment for grid cell text.

SetDefaultCellBackgroundColour

Sets the default background colour for grid cells.

SetDefaultCellFitMode

Specifies the default behaviour of the cell contents if it doesn’t fit into the available space.

SetDefaultCellFont

Sets the default font to be used for grid cell text.

SetDefaultCellOverflow

Sets the default overflow permission of the cells.

SetDefaultCellTextColour

Sets the current default colour for grid cell text.

SetDefaultColSize

Sets the default width for columns in the grid.

SetDefaultEditor

Sets the default editor for grid cells.

SetDefaultRenderer

Sets the default renderer for grid cells.

SetDefaultRowSize

Sets the default height for rows in the grid.

SetGridCursor

Set the grid cursor to the specified cell.

SetGridFrozenBorderColour

SetGridFrozenBorderPenWidth

SetGridLineColour

Sets the colour used to draw grid lines.

SetLabelBackgroundColour

Sets the background colour for row and column labels.

SetLabelFont

Sets the font for row and column labels.

SetLabelTextColour

Sets the colour for row and column label text.

SetMargins

Sets the extra margins used around the grid area.

SetReadOnly

Makes the cell at the specified location read-only or editable.

SetRowAttr

Sets the cell attributes for all cells in the specified row.

SetRowLabelAlignment

Sets the horizontal and vertical alignment of row label text.

SetRowLabelSize

Sets the width of the row labels.

SetRowLabelValue

Sets the value for the given row label.

SetRowMinimalAcceptableHeight

Sets the minimal row height used by default.

SetRowMinimalHeight

Sets the minimal height for the specified row.

SetRowSize

Sets the height of the specified row.

SetRowSizes

Restore all rows sizes.

SetScrollLineX

Sets the number of pixels per horizontal scroll increment.

SetScrollLineY

Sets the number of pixels per vertical scroll increment.

SetSelectionBackground

Set the colour to be used for drawing the selection background.

SetSelectionForeground

Set the colour to be used for drawing the selection foreground.

SetSelectionMode

Set the selection behaviour of the grid.

SetSortingColumn

Set the column to display the sorting indicator in and its direction.

SetTabBehaviour

Set the grid’s behaviour when the user presses the TAB key.

_SetTable

Passes a pointer to a custom grid table to be used by the grid.

SetTable

Set the Grid Table to be used by this grid.

SetUseNativeColLabels

Call this in order to make the column labels use a native look by using wx.RendererNative.DrawHeaderButton internally.

ShowCellEditControl

Displays the active in-place cell edit control for the current cell after it was hidden.

ShowCol

Shows the previously hidden column by resizing it to non-0 size.

ShowRow

Shows the previously hidden row.

UnsetSortingColumn

Remove any currently shown sorting indicator.

UseNativeColHeader

Enable the use of native header window for column labels.

XToCol

Returns the column at the given pixel position depending on the window.

XToEdgeOfCol

Returns the column whose right hand edge is close to the given logical x position.

XYToCell

Translates logical pixel coordinates to the grid cell coordinates.

YToEdgeOfRow

Returns the row whose bottom edge is close to the given logical y position.

YToRow

Returns the grid row that corresponds to the logical y coordinate.


property_summary Properties Summary

BatchCount

See GetBatchCount

CellHighlightColour

See GetCellHighlightColour and SetCellHighlightColour

CellHighlightPenWidth

See GetCellHighlightPenWidth and SetCellHighlightPenWidth

CellHighlightROPenWidth

See GetCellHighlightROPenWidth and SetCellHighlightROPenWidth

ColLabelSize

See GetColLabelSize and SetColLabelSize

ColLabelTextOrientation

See GetColLabelTextOrientation and SetColLabelTextOrientation

ColMinimalAcceptableWidth

See GetColMinimalAcceptableWidth and SetColMinimalAcceptableWidth

ColSizes

See GetColSizes and SetColSizes

CornerLabelTextOrientation

See GetCornerLabelTextOrientation and SetCornerLabelTextOrientation

CornerLabelValue

See GetCornerLabelValue and SetCornerLabelValue

DefaultCellBackgroundColour

See GetDefaultCellBackgroundColour and SetDefaultCellBackgroundColour

DefaultCellFitMode

See GetDefaultCellFitMode and SetDefaultCellFitMode

DefaultCellFont

See GetDefaultCellFont and SetDefaultCellFont

DefaultCellOverflow

See GetDefaultCellOverflow and SetDefaultCellOverflow

DefaultCellTextColour

See GetDefaultCellTextColour and SetDefaultCellTextColour

DefaultColLabelSize

See GetDefaultColLabelSize

DefaultColSize

See GetDefaultColSize and SetDefaultColSize

DefaultEditor

See GetDefaultEditor and SetDefaultEditor

DefaultGridLinePen

See GetDefaultGridLinePen

DefaultRenderer

See GetDefaultRenderer and SetDefaultRenderer

DefaultRowLabelSize

See GetDefaultRowLabelSize

DefaultRowSize

See GetDefaultRowSize and SetDefaultRowSize

FirstFullyVisibleColumn

See GetFirstFullyVisibleColumn

FirstFullyVisibleRow

See GetFirstFullyVisibleRow

FrozenColGridWindow

See GetFrozenColGridWindow

FrozenCornerGridWindow

See GetFrozenCornerGridWindow

FrozenRowGridWindow

See GetFrozenRowGridWindow

GridColHeader

See GetGridColHeader

GridColLabelWindow

See GetGridColLabelWindow

GridCornerLabelWindow

See GetGridCornerLabelWindow

GridCursorCol

See GetGridCursorCol

GridCursorCoords

See GetGridCursorCoords

GridCursorRow

See GetGridCursorRow

GridLineColour

See GetGridLineColour and SetGridLineColour

GridRowLabelWindow

See GetGridRowLabelWindow

GridWindow

See GetGridWindow

LabelBackgroundColour

See GetLabelBackgroundColour and SetLabelBackgroundColour

LabelFont

See GetLabelFont and SetLabelFont

LabelTextColour

See GetLabelTextColour and SetLabelTextColour

NumberCols

See GetNumberCols

NumberFrozenCols

See GetNumberFrozenCols

NumberFrozenRows

See GetNumberFrozenRows

NumberRows

See GetNumberRows

RowLabelSize

See GetRowLabelSize and SetRowLabelSize

RowMinimalAcceptableHeight

See GetRowMinimalAcceptableHeight and SetRowMinimalAcceptableHeight

RowSizes

See GetRowSizes and SetRowSizes

ScrollLineX

See GetScrollLineX and SetScrollLineX

ScrollLineY

See GetScrollLineY and SetScrollLineY

SelectedBlocks

See GetSelectedBlocks

SelectedCells

See GetSelectedCells

SelectedCols

See GetSelectedCols

SelectedRows

See GetSelectedRows

SelectionBackground

See GetSelectionBackground and SetSelectionBackground

SelectionBlockBottomRight

See GetSelectionBlockBottomRight

SelectionBlockTopLeft

See GetSelectionBlockTopLeft

SelectionForeground

See GetSelectionForeground and SetSelectionForeground

SelectionMode

See GetSelectionMode and SetSelectionMode

SortingColumn

See GetSortingColumn and SetSortingColumn

Table

See GetTable and SetTable


api Class API

class wx.grid.Grid(ScrolledCanvas)

Possible constructors:

Grid()

Grid(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
     style=WANTS_CHARS, name=GridNameStr)

Grid and its related classes are used for displaying and editing tabular data.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.

You must call Create to really create the grid window and also call CreateGrid or SetTable or AssignTable to initialize its contents.



__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=WANTS_CHARS, name=GridNameStr)

Constructor creating the grid window.

You must call either CreateGrid or SetTable or AssignTable to initialize the grid contents before using it.

Parameters





AppendCols(self, numCols=1, updateLabels=True)

Appends one or more new columns to the right of the grid.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.AppendCols . See InsertCols for further information.

Parameters
  • numCols (int) –

  • updateLabels (bool) –

Return type

bool

Returns

True on success or False if appending columns failed.



AppendRows(self, numRows=1, updateLabels=True)

Appends one or more new rows to the bottom of the grid.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.AppendRows . See InsertRows for further information.

Parameters
  • numRows (int) –

  • updateLabels (bool) –

Return type

bool

Returns

True on success or False if appending rows failed.



AreHorzGridLinesClipped(self)

Return True if the horizontal grid lines stop at the last column boundary or False if they continue to the end of the window.

The default is to clip grid lines.

Return type

bool



AreVertGridLinesClipped(self)

Return True if the vertical grid lines stop at the last row boundary or False if they continue to the end of the window.

The default is to clip grid lines.

Return type

bool



AssignTable(self, table, selmode=GridSelectCells)

Assigns a pointer to a custom grid table to be used by the grid.

This function is identical to SetTable with takeOwnership parameter set to True, i.e. it simply always takes the ownership of the passed in pointer. This makes it simpler to use than SetTable in the common case when the table should be owned by the grid object.

Note that this function should be called at most once and can’t be used to change the table used by the grid later on or reset it: if such extra flexibility is needed, use SetTable directly.

Parameters

New in version 4.1/wxWidgets-3.1.4.



AutoSize(self)

Automatically sets the height and width of all rows and columns to fit their contents.



AutoSizeColLabelSize(self, col)

Automatically adjusts width of the column to fit its label.

Parameters

col (int) –



AutoSizeColumn(self, col, setAsMin=True)

Automatically sizes the column to fit its contents.

If setAsMin is True the calculated width will also be set as the minimal width for the column.

Parameters
  • col (int) –

  • setAsMin (bool) –



AutoSizeColumns(self, setAsMin=True)

Automatically sizes all columns to fit their contents.

If setAsMin is True the calculated widths will also be set as the minimal widths for the columns.

Parameters

setAsMin (bool) –



AutoSizeRow(self, row, setAsMin=True)

Automatically sizes the row to fit its contents.

If setAsMin is True the calculated height will also be set as the minimal height for the row.

Parameters
  • row (int) –

  • setAsMin (bool) –



AutoSizeRowLabelSize(self, col)

Automatically adjusts height of the row to fit its label.

Parameters

col (int) –



AutoSizeRows(self, setAsMin=True)

Automatically sizes all rows to fit their contents.

If setAsMin is True the calculated heights will also be set as the minimal heights for the rows.

Parameters

setAsMin (bool) –



BeginBatch(self)

Increments the grid’s batch count.

When the count is greater than zero repainting of the grid is suppressed. Each call to BeginBatch must be matched by a later call to EndBatch . Code that does a lot of grid modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch call will cause the grid to be repainted.

Notice that you should use wx.grid.GridUpdateLocker which ensures that there is always a matching EndBatch call for this BeginBatch if possible instead of calling this method directly.



BlockToDeviceRect(self, topLeft, bottomRight, gridWindow=None)

Convert grid cell coordinates to grid window pixel coordinates.

This function returns the rectangle that encloses the block of cells limited by topLeft and bottomRight cell in device coords and clipped to the client size of the grid window.

Parameters
Return type

Rect

New in version 4.1/wxWidgets-3.1.3: Parameter gridWindow has been added.

See also

CellToRect



CalcCellsExposed(self, reg, gridWindow=None)

Appends one or more new columns to the right of the grid.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.AppendCols . See InsertCols for further information.

Parameters
  • reg (wx.Region) –

  • gridWindow (wx.grid.GridWindow) –

Return type

GridCellCoordsArray

Returns

True on success or False if appending columns failed.



CalcColLabelsExposed(self, reg, gridWindow=None)

Appends one or more new columns to the right of the grid.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.AppendCols . See InsertCols for further information.

Parameters
  • reg (wx.Region) –

  • gridWindow (wx.grid.GridWindow) –

Return type

list of integers

Returns

True on success or False if appending columns failed.



CalcGridWindowScrolledPosition(self, *args, **kw)

overload Overloaded Implementations:



CalcGridWindowScrolledPosition (self, x, y, xx, yy, gridWindow)

Translates the logical coordinates to the device ones, taking into account the grid window type.

Parameters
  • x (int) –

  • y (int) –

  • xx (int) –

  • yy (int) –

  • gridWindow (wx.grid.GridWindow) –

New in version 4.1/wxWidgets-3.1.3.



CalcGridWindowScrolledPosition (self, pt, gridWindow)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
  • pt (wx.Point) –

  • gridWindow (wx.grid.GridWindow) –

Return type

Point





CalcGridWindowUnscrolledPosition(self, *args, **kw)

overload Overloaded Implementations:



CalcGridWindowUnscrolledPosition (self, x, y, xx, yy, gridWindow)

Translates the device coordinates to the logical ones, taking into account the grid window type.

Parameters
  • x (int) –

  • y (int) –

  • xx (int) –

  • yy (int) –

  • gridWindow (wx.grid.GridWindow) –

New in version 4.1/wxWidgets-3.1.3.



CalcGridWindowUnscrolledPosition (self, pt, gridWindow)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
  • pt (wx.Point) –

  • gridWindow (wx.grid.GridWindow) –

Return type

Point





CalcRowLabelsExposed(self, reg, gridWindow=None)

Appends one or more new columns to the right of the grid.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.AppendCols . See InsertCols for further information.

Parameters
  • reg (wx.Region) –

  • gridWindow (wx.grid.GridWindow) –

Return type

list of integers

Returns

True on success or False if appending columns failed.



CanDragCell(self)

Return True if the dragging of cells is enabled or False otherwise.

Return type

bool



CanDragColMove(self)

Returns True if columns can be moved by dragging with the mouse.

Columns can be moved by dragging on their labels.

Return type

bool



CanDragColSize(self, col)

Returns True if the given column can be resized by dragging with the mouse.

This function returns True if resizing the columns interactively is globally enabled, i.e. if DisableDragColSize hadn’t been called, and if this column wasn’t explicitly marked as non-resizable with DisableColResize .

Parameters

col (int) –

Return type

bool



CanDragGridSize(self)

Return True if the dragging of grid lines to resize rows and columns is enabled or False otherwise.

Return type

bool



CanDragRowSize(self, row)

Returns True if the given row can be resized by dragging with the mouse.

This is the same as CanDragColSize but for rows.

Parameters

row (int) –

Return type

bool



CanEnableCellControl(self)

Returns True if the in-place edit control for the current grid cell can be used and False otherwise.

This function always returns False for the read-only cells.

Return type

bool



CanHaveAttributes(self)

Returns True if this grid has support for cell attributes.

The grid supports attributes if it has the associated table which, in turn, has attributes support, i.e. wx.grid.GridTableBase.CanHaveAttributes returns True.

Return type

bool



CanHideColumns(self)

Returns True if columns can be hidden from the popup menu of the native header.

Return type

bool

New in version 4.1/wxWidgets-3.1.3.



CellToGridWindow(self, *args, **kw)

overload Overloaded Implementations:



CellToGridWindow (self, row, col)

Returns the grid window that contains the cell.

In a grid without frozen rows or columns (see FreezeTo ), this will always return the same window as GetGridWindow , however if some parts of the grid are frozen, this function returns the window containing the given cell.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridWindow

New in version 4.1/wxWidgets-3.1.3.



CellToGridWindow (self, coords)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters

coords (wx.grid.GridCellCoords) –

Return type

wx.grid.GridWindow





CellToRect(self, *args, **kw)

Return the rectangle corresponding to the grid cell’s size and position in logical coordinates.

overload Overloaded Implementations:



CellToRect (self, row, col)

Parameters
  • row (int) –

  • col (int) –

Return type

Rect



CellToRect (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –

Return type

Rect





ClearGrid(self)

Clears all data in the underlying grid table and repaints the grid.

The table is not deleted by this function. If you are using a derived table class then you need to override wx.grid.GridTableBase.Clear for this function to have any effect.



ClearSelection(self)

Deselects all cells that are currently selected.



ClipHorzGridLines(self, clip)

Change whether the horizontal grid lines are clipped by the end of the last column.

By default the grid lines are not drawn beyond the end of the last column but after calling this function with clip set to False they will be drawn across the entire grid window.

Parameters

clip (bool) –



ClipVertGridLines(self, clip)

Change whether the vertical grid lines are clipped by the end of the last row.

By default the grid lines are not drawn beyond the end of the last row but after calling this function with clip set to False they will be drawn across the entire grid window.

Parameters

clip (bool) –



Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=WANTS_CHARS, name=GridNameStr)

Creates the grid window for an object initialized using the default constructor.

You must call either CreateGrid or SetTable or AssignTable to initialize the grid contents before using it.

Parameters
Return type

bool



CreateGrid(self, numRows, numCols, selmode=GridSelectCells)

Creates a grid with the specified initial number of rows and columns.

Call this directly after the grid constructor. When you use this function wx.grid.Grid will create and manage a simple table of string values for you. All of the grid data will be stored in memory.

For applications with more complex data types or relationships, or for dealing with very large datasets, you should derive your own grid table class and pass a table object to the grid with SetTable or AssignTable .

Parameters
Return type

bool



DeleteCols(self, pos=0, numCols=1, updateLabels=True)

Deletes one or more columns from a grid starting at the specified position.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.DeleteCols . See InsertCols for further information.

Parameters
  • pos (int) –

  • numCols (int) –

  • updateLabels (bool) –

Return type

bool

Returns

True on success or False if deleting columns failed.



DeleteRows(self, pos=0, numRows=1, updateLabels=True)

Deletes one or more rows from a grid starting at the specified position.

The updateLabels argument is not used at present. If you are using a derived grid table class you will need to override wx.grid.GridTableBase.DeleteRows . See InsertRows for further information.

Parameters
  • pos (int) –

  • numRows (int) –

  • updateLabels (bool) –

Return type

bool

Returns

True on success or False if deleting rows failed.



DeselectCell(self, row, col)

Deselects a cell.

Parameters
  • row (int) –

  • col (int) –



DeselectCol(self, col)

Deselects a column of cells.

Parameters

col (int) –



DeselectRow(self, row)

Deselects a row of cells.

Parameters

row (int) –



DevicePosToGridWindow(self, *args, **kw)

overload Overloaded Implementations:



DevicePosToGridWindow (self, pos)

Returns the grid window that includes the input coordinates.

Parameters

pos (wx.Point) –

Return type

wx.grid.GridWindow

New in version 4.1/wxWidgets-3.1.3.



DevicePosToGridWindow (self, x, y)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
  • x (int) –

  • y (int) –

Return type

wx.grid.GridWindow





DisableCellEditControl(self)

Disables in-place editing of grid cells.

Equivalent to calling EnableCellEditControl(false).



DisableColResize(self, col)

Disable interactive resizing of the specified column.

This method allows one to disable resizing of an individual column in a grid where the columns are otherwise resizable (which is the case by default).

Notice that currently there is no way to make some columns resizable in a grid where columns can’t be resized by default as there doesn’t seem to be any need for this in practice. There is also no way to make the column marked as fixed using this method resizable again because it is supposed that fixed columns are used for static parts of the grid and so should remain fixed during the entire grid lifetime.

Also notice that disabling interactive column resizing will not prevent the program from changing the column size.

Parameters

col (int) –



DisableDragColMove(self)

Disables column moving by dragging with the mouse.

Equivalent to passing False to EnableDragColMove .



DisableDragColSize(self)

Disables column sizing by dragging with the mouse.

Equivalent to passing False to EnableDragColSize .



DisableDragGridSize(self)

Disable mouse dragging of grid lines to resize rows and columns.

Equivalent to passing False to EnableDragGridSize



DisableDragRowSize(self)

Disables row sizing by dragging with the mouse.

Equivalent to passing False to EnableDragRowSize .



DisableHidingColumns(self)

Disables column hiding from the header popup menu.

Equivalent to passing False to EnableHidingColumns .

New in version 4.1/wxWidgets-3.1.3.



DisableRowResize(self, row)

Disable interactive resizing of the specified row.

This is the same as DisableColResize but for rows.

Parameters

row (int) –



DrawCellHighlight(self, dc, attr)
Parameters


DrawColLabel(self, dc, col)
Parameters
  • dc (wx.DC) –

  • col (int) –



DrawColLabels(self, dc, cols)
Parameters
  • dc (wx.DC) –

  • cols (list of integers) –



DrawCornerLabel(self, dc)
Parameters

dc (wx.DC) –



DrawRowLabel(self, dc, row)
Parameters
  • dc (wx.DC) –

  • row (int) –



DrawRowLabels(self, dc, rows)
Parameters
  • dc (wx.DC) –

  • rows (list of integers) –



DrawTextRectangle(self, *args, **kw)

overload Overloaded Implementations:



DrawTextRectangle (self, dc, text, rect, horizontalAlignment=ALIGN_LEFT, verticalAlignment=ALIGN_TOP, textOrientation=HORIZONTAL)

Parameters
  • dc (wx.DC) –

  • text (string) –

  • rect (wx.Rect) –

  • horizontalAlignment (int) –

  • verticalAlignment (int) –

  • textOrientation (int) –



DrawTextRectangle (self, dc, lines, rect, horizontalAlignment=ALIGN_LEFT, verticalAlignment=ALIGN_TOP, textOrientation=HORIZONTAL)

Parameters
  • dc (wx.DC) –

  • lines (list of strings) –

  • rect (wx.Rect) –

  • horizontalAlignment (int) –

  • verticalAlignment (int) –

  • textOrientation (int) –





EnableCellEditControl(self, enable=True)

Enables or disables in-place editing of grid cell data.

Enabling in-place editing generates wxEVT_GRID_EDITOR_SHOWN and, if it isn’t vetoed by the application, shows the in-place editor which allows the user to change the cell value.

Disabling in-place editing does nothing if the in-place editor isn’t currently show, otherwise the wxEVT_GRID_EDITOR_HIDDEN event is generated but, unlike the “shown” event, it can’t be vetoed and the in-place editor is dismissed unconditionally.

Parameters

enable (bool) –



EnableDragCell(self, enable=True)

Enables or disables cell dragging with the mouse.

Parameters

enable (bool) –



EnableDragColMove(self, enable=True)

Enables or disables column moving by dragging with the mouse.

Note that reordering columns by dragging them is currently not supported when the grid has any frozen columns (see FreezeTo ) and if this method is called with enable equal to True in this situation, it returns False without doing anything. Otherwise it returns True to indicate that it was successful.

Parameters

enable (bool) –

Return type

bool



EnableDragColSize(self, enable=True)

Enables or disables column sizing by dragging with the mouse.

Parameters

enable (bool) –

See also

DisableColResize



EnableDragGridSize(self, enable=True)

Enables or disables row and column resizing by dragging gridlines with the mouse.

Parameters

enable (bool) –



EnableDragRowSize(self, enable=True)

Enables or disables row sizing by dragging with the mouse.

Parameters

enable (bool) –

See also

DisableRowResize



EnableEditing(self, edit)

Makes the grid globally editable or read-only.

If the edit argument is False this function sets the whole grid as read-only. If the argument is True the grid is set to the default state where cells may be editable. In the default state you can set single grid cells and whole rows and columns to be editable or read-only via wx.grid.GridCellAttr.SetReadOnly . For single cells you can also use the shortcut function SetReadOnly .

For more information about controlling grid cell attributes see the wx.grid.GridCellAttr class and the Grid Overview.

Parameters

edit (bool) –



EnableGridLines(self, enable=True)

Turns the drawing of grid lines on or off.

Parameters

enable (bool) –



EnableHidingColumns(self, enable=True)

Enables or disables column hiding from the header popup menu.

Note that currently the popup menu can only be shown when using wx.HeaderCtrl, i.e. if UseNativeColHeader had been called.

If the native header is not used, this method always simply returns False without doing anything, as hiding columns is not supported anyhow. If enable value is the same as CanHideColumns , it also returns False to indicate that nothing was done. Otherwise, it returns True to indicate that the value of this option was successfully changed.

The main use case for this method is to disallow hiding the columns interactively when using the native header.

Parameters

enable (bool) –

Return type

bool

New in version 4.1/wxWidgets-3.1.3.



EndBatch(self)

Decrements the grid’s batch count.

When the count is greater than zero repainting of the grid is suppressed. Each previous call to BeginBatch must be matched by a later call to EndBatch . Code that does a lot of grid modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will cause the grid to be repainted.



Fit(self)

Overridden wx.Window method.



ForceRefresh(self)

Causes immediate repainting of the grid.

Use this instead of the usual wx.Window.Refresh .



FreezeTo(self, *args, **kw)

overload Overloaded Implementations:



FreezeTo (self, row, col)

Sets or resets the frozen columns and rows.

Parameters
  • row – The number of rows to freeze, 0 means to unfreeze all rows.

  • col – The number of columns to freeze, 0 means to unfreeze all columns.

Return type

bool

Note that this method doesn’t do anything, and returns False, if any of the following conditions are True:

  • Either row or col are out of range

  • Size of the frozen area would be bigger than the current viewing area

  • There are any merged cells in the area to be frozen

  • Grid uses a native header control (see UseNativeColHeader )

(some of these limitations could be lifted in the future).

Returns

True on success or False if it failed.

New in version 4.1/wxWidgets-3.1.3.



FreezeTo (self, coords)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters

coords (wx.grid.GridCellCoords) –

Return type

bool





GetBatchCount(self)

Returns the number of times that BeginBatch has been called without (yet) matching calls to EndBatch .

While the grid’s batch count is greater than zero the display will not be updated.

Return type

int



GetCellAlignment(self, row, col)

Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location.

Horizontal alignment will be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment will be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • row (int) –

  • col (int) –

Return type

tuple

Returns

( horiz, vert )



GetCellBackgroundColour(self, row, col)

Returns the background colour of the cell at the specified location.

Parameters
  • row (int) –

  • col (int) –

Return type

Colour



GetCellEditor(self, row, col)

Returns a pointer to the editor for the cell at the specified location.

See wx.grid.GridCellEditor and the Grid Overview for more information about cell editors and renderers.

The caller must call DecRef() on the returned pointer.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellEditor



GetCellFitMode(self, row, col)

Returns the cell fitting mode.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridFitMode

New in version 4.1/wxWidgets-3.1.4.



GetCellFont(self, row, col)

Returns the font for text in the grid cell at the specified location.

Parameters
  • row (int) –

  • col (int) –

Return type

Font



GetCellHighlightColour(self)
Return type

Colour



GetCellHighlightPenWidth(self)
Return type

int



GetCellHighlightROPenWidth(self)
Return type

int



GetCellOverflow(self, row, col)

Returns True if the cell value can overflow.

This is identical to calling GetCellFitMode and using wx.grid.GridFitMode.IsOverflow on the returned value.

Prefer using GetCellFitMode directly in the new code.

Parameters
  • row (int) –

  • col (int) –

Return type

bool



GetCellRenderer(self, row, col)

Returns a pointer to the renderer for the grid cell at the specified location.

See wx.grid.GridCellRenderer and the Grid Overview for more information about cell editors and renderers.

The caller must call DecRef() on the returned pointer.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellRenderer



GetCellSize(self, *args, **kw)

overload Overloaded Implementations:



GetCellSize (self, row, col, num_rows, num_cols)

Get the size of the cell in number of cells covered by it.

For normal cells, the function fills both num_rows and num_cols with 1 and returns CellSpan_None. For cells which span multiple cells, i.e. for which SetCellSize had been called, the returned values are the same ones as were passed to SetCellSize call and the function return value is CellSpan_Main.

More unexpectedly, perhaps, the returned values may be negative for the cells which are inside a span covered by a cell occupying multiple rows or columns. They correspond to the offset of the main cell of the span from the cell passed to this functions and the function returns CellSpan_Inside value to indicate this.

As an example, consider a 3x3 grid with the cell (1, 1) (the one in the middle) having a span of 2 rows and 2 columns, i.e. the grid looks like

+----+----+----+
|    |    |    |
+----+----+----+
|    |         |
+----+         |
|    |         |
+----+----+----+

Then the function returns 2 and 2 in num_rows and num_cols for the cell (1, 1) itself and -1 and -1 for the cell (2, 2) as well as -1 and 0 for the cell (2, 1).

Parameters
  • row (int) – The row of the cell.

  • col (int) – The column of the cell.

  • num_rows (int) – Pointer to variable receiving the number of rows, must not be None.

  • num_cols (int) – Pointer to variable receiving the number of columns, must not be None.

Return type

wx.grid.Grid.CellSpan

Returns

The kind of this cell span (the return value is new in wxWidgets 2.9.1, this function was in previous wxWidgets versions).



GetCellSize (self, coords)

Get the number of rows and columns allocated for this cell.

This overload doesn’t return a CellSpan value but the values returned may still be negative, see GetCellSize(int, int, int, int ) for details.

Parameters

coords (wx.grid.GridCellCoords) –

Return type

Size





GetCellTextColour(self, row, col)

Returns the text colour for the grid cell at the specified location.

Parameters
  • row (int) –

  • col (int) –

Return type

Colour



GetCellValue(self, *args, **kw)

Returns the string contained in the cell at the specified location.

For simple applications where a grid object automatically uses a default grid table of string values you use this function together with SetCellValue to access cell values. For more complex applications where you have derived your own grid table class that contains various data types (e.g. numeric, boolean or user-defined custom types) then you only use this function for those cells that contain string values.

See wx.grid.GridTableBase.CanGetValueAs and the Grid Overview for more information.

overload Overloaded Implementations:



GetCellValue (self, row, col)

Parameters
  • row (int) –

  • col (int) –

Return type

string



GetCellValue (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –

Return type

string





static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters

variant (WindowVariant) –

Return type

VisualAttributes



GetColAt(self, colPos)

Returns the column ID of the specified column position.

Parameters

colPos (int) –

Return type

int



GetColGridLinePen(self, col)

Returns the pen used for vertical grid lines.

This virtual function may be overridden in derived classes in order to change the appearance of individual grid lines for the given column col.

See GetRowGridLinePen for an example.

Parameters

col (int) –

Return type

Pen



GetColLabelAlignment(self)

Sets the arguments to the current column label alignment values.

Horizontal alignment will be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment will be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Return type

tuple

Returns

( horiz, vert )



GetColLabelSize(self)

Returns the current height of the column labels.

Return type

int



GetColLabelTextOrientation(self)

Returns the orientation of the column labels (either HORIZONTAL or VERTICAL ).

Return type

int



GetColLabelValue(self, col)

Returns the specified column label.

The default grid table class provides column labels of the form A,B…Z,AA,AB…ZZ,AAA… If you are using a custom grid table you can override wx.grid.GridTableBase.GetColLabelValue to provide your own labels.

Parameters

col (int) –

Return type

string



GetColLeft(self, col)

Returns the coordinate of the left border specified column.

Parameters

col (int) –

Return type

int



GetColMinimalAcceptableWidth(self)

Returns the minimal width to which a column may be resized.

Use SetColMinimalAcceptableWidth to change this value globally or SetColMinimalWidth to do it for individual columns.

Return type

int



GetColMinimalWidth(self, col)

Get the minimal width of the given column/row.

The value returned by this function may be different from that returned by GetColMinimalAcceptableWidth if SetColMinimalWidth had been called for this column.

Parameters

col (int) –

Return type

int



GetColPos(self, colID)

Returns the position of the specified column.

Parameters

colID (int) –

Return type

int



GetColRight(self, col)

Returns the coordinate of the right border specified column.

Parameters

col (int) –

Return type

int



GetColSize(self, col)

Returns the width of the specified column.

Parameters

col (int) –

Return type

int



GetColSizes(self)

Get size information for all columns at once.

This method is useful when the information about all column widths needs to be saved. The widths can be later restored using SetColSizes .

Return type

wx.grid.GridSizesInfo



GetCornerLabelAlignment(self, horiz, vert)

Sets the arguments to the current corner label alignment values.

Horizontal alignment will be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment will be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • horiz (int) –

  • vert (int) –

New in version 4.1/wxWidgets-3.1.2.



GetCornerLabelTextOrientation(self)

Returns the orientation of the corner label (either HORIZONTAL or VERTICAL ).

Return type

int

New in version 4.1/wxWidgets-3.1.2.



GetCornerLabelValue(self)

Returns the (top-left) corner label.

Return type

string

New in version 4.1/wxWidgets-3.1.2.



GetDefaultCellAlignment(self)

Returns the default cell alignment.

Horizontal alignment will be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment will be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Return type

tuple

Returns

( horiz, vert )



GetDefaultCellBackgroundColour(self)

Returns the current default background colour for grid cells.

Return type

Colour



GetDefaultCellFitMode(self)

Returns the default cell fitting mode.

The default mode is “overflow”, but can be modified using SetDefaultCellFitMode .

Return type

wx.grid.GridFitMode

New in version 4.1/wxWidgets-3.1.4.



GetDefaultCellFont(self)

Returns the current default font for grid cell text.

Return type

Font



GetDefaultCellOverflow(self)

Returns True if the cells can overflow by default.

This is identical to calling GetDefaultCellFitMode and using wx.grid.GridFitMode.IsOverflow on the returned value.

Prefer using GetDefaultCellFitMode directly in the new code.

Return type

bool



GetDefaultCellTextColour(self)

Returns the current default colour for grid cell text.

Return type

Colour



GetDefaultColLabelSize(self)

Returns the default height for column labels.

Return type

int



GetDefaultColSize(self)

Returns the current default width for grid columns.

Return type

int



GetDefaultEditor(self)

Returns a pointer to the current default grid cell editor.

See wx.grid.GridCellEditor and the Grid Overview for more information about cell editors and renderers.

Return type

wx.grid.GridCellEditor



GetDefaultEditorForCell(self, *args, **kw)

Returns the default editor for the specified cell.

The base class version returns the editor appropriate for the current cell type but this method may be overridden in the derived classes to use custom editors for some cells by default.

Notice that the same may be achieved in a usually simpler way by associating a custom editor with the given cell or cells.

The caller must call DecRef() on the returned pointer.

overload Overloaded Implementations:



GetDefaultEditorForCell (self, row, col)

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellEditor



GetDefaultEditorForCell (self, c)

Parameters

c (wx.grid.GridCellCoords) –

Return type

wx.grid.GridCellEditor





GetDefaultEditorForType(self, typeName)

Returns the default editor for the cells containing values of the given type.

The base class version returns the editor which was associated with the specified typeName when it was registered RegisterDataType but this function may be overridden to return something different. This allows overriding an editor used for one of the standard types.

The caller must call DecRef() on the returned pointer.

Parameters

typeName (string) –

Return type

wx.grid.GridCellEditor



GetDefaultGridLinePen(self)

Returns the pen used for grid lines.

This virtual function may be overridden in derived classes in order to change the appearance of grid lines. Note that currently the pen width must be 1.

Return type

Pen



GetDefaultRenderer(self)

Returns a pointer to the current default grid cell renderer.

See wx.grid.GridCellRenderer and the Grid Overview for more information about cell editors and renderers.

The caller must call DecRef() on the returned pointer.

Return type

wx.grid.GridCellRenderer



GetDefaultRendererForCell(self, row, col)

Returns the default renderer for the given cell.

The base class version returns the renderer appropriate for the current cell type but this method may be overridden in the derived classes to use custom renderers for some cells by default.

The caller must call DecRef() on the returned pointer.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellRenderer



GetDefaultRendererForType(self, typeName)

Returns the default renderer for the cell containing values of the given type.

Parameters

typeName (string) –

Return type

wx.grid.GridCellRenderer



GetDefaultRowLabelSize(self)

Returns the default width for the row labels.

Return type

int



GetDefaultRowSize(self)

Returns the current default height for grid rows.

Return type

int



GetFirstFullyVisibleColumn(self)

Returns the leftmost column of the current visible area.

Returns -1 if the grid doesn’t have any columns.

Return type

int



GetFirstFullyVisibleRow(self)

Returns the topmost row of the current visible area.

Returns -1 if the grid doesn’t have any rows.

Return type

int



GetFrozenColGridWindow(self)

Return the columns grid window containing column frozen cells.

This window is shown only when there are frozen columns.

Return type

Window

New in version 4.1/wxWidgets-3.1.3.



GetFrozenCornerGridWindow(self)

Return the corner grid window containing frozen cells.

This window is shown only when there are frozen rows and columns.

Return type

Window

New in version 4.1/wxWidgets-3.1.3.



GetFrozenRowGridWindow(self)

Return the rows grid window containing row frozen cells.

This window is shown only when there are frozen rows.

Return type

Window

New in version 4.1/wxWidgets-3.1.3.



GetGridColHeader(self)

Return the header control used for column labels display.

This function can only be called if UseNativeColHeader had been called.

Return type

HeaderCtrl



GetGridColLabelWindow(self)

Return the column labels window.

This window is not shown if the columns labels were hidden using HideColLabels .

Depending on whether UseNativeColHeader was called or not this can be either a wx.HeaderCtrl or a plain wx.Window. This function returns a valid window pointer in either case but in the former case you can also use GetGridColHeader to access it if you need HeaderCtrl-specific functionality.

Return type

Window



GetGridCornerLabelWindow(self)

Return the window in the top left grid corner.

This window is shown only of both columns and row labels are shown and normally doesn’t contain anything. Clicking on it is handled by wx.grid.Grid however and can be used to select the entire grid.

Return type

Window



GetGridCursorCol(self)

Returns the current grid cell column position.

Return type

int



GetGridCursorCoords(self)

Returns the current grid cursor position.

If grid cursor doesn’t have any valid position (e.g. if the grid is completely empty and doesn’t have any rows or columns), returns GridNoCellCoords which has both row and columns set to -1 .

Return type

wx.grid.GridCellCoords

New in version 4.1/wxWidgets-3.1.3.



GetGridCursorRow(self)

Returns the current grid cell row position.

Return type

int



GetGridLineColour(self)

Returns the colour used for grid lines.

Return type

Colour



GetGridRowLabelWindow(self)

Return the row labels window.

This window is not shown if the row labels were hidden using HideRowLabels .

Return type

Window



GetGridWindow(self)

Return the main grid window containing the grid cells.

This window is always shown.

Return type

Window



GetGridWindowOffset(self, gridWindow)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters

gridWindow (wx.grid.GridWindow) –

Return type

Point



GetLabelBackgroundColour(self)

Returns the colour used for the background of row and column labels.

Return type

Colour



GetLabelFont(self)

Returns the font used for row and column labels.

Return type

Font



GetLabelTextColour(self)

Returns the colour used for row and column label text.

Return type

Colour



GetNumberCols(self)

Returns the total number of grid columns.

This is the same as the number of columns in the underlying grid table.

Return type

int



GetNumberFrozenCols(self)

Returns the number of frozen grid columns.

If there are no frozen columns, returns 0.

Return type

int

New in version 4.1/wxWidgets-3.1.3.

See also

FreezeTo



GetNumberFrozenRows(self)

Returns the number of frozen grid rows.

If there are no frozen rows, returns 0.

Return type

int

New in version 4.1/wxWidgets-3.1.3.

See also

FreezeTo



GetNumberRows(self)

Returns the total number of grid rows.

This is the same as the number of rows in the underlying grid table.

Return type

int



GetOrCreateCellAttr(self, row, col)

Returns the attribute for the given cell creating one if necessary.

If the cell already has an attribute, it is returned. Otherwise a new attribute is created, associated with the cell and returned. In any case the caller must call DecRef() on the returned pointer.

Prefer to use GetOrCreateCellAttrPtr to avoid the need to call DecRef() on the returned pointer.

This function may only be called if CanHaveAttributes returns True.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellAttr



GetOrCreateCellAttrPtr(self, row, col)

Returns the attribute for the given cell creating one if necessary.

This method is identical to GetOrCreateCellAttr , but returns a smart pointer, which frees the caller from the need to call DecRef() manually.

Parameters
  • row (int) –

  • col (int) –

Return type

wx.grid.GridCellAttrPtr

New in version 4.1/wxWidgets-3.1.4.



GetRowGridLinePen(self, row)

Returns the pen used for horizontal grid lines.

This virtual function may be overridden in derived classes in order to change the appearance of individual grid line for the given row.

Example:

# in a grid displaying music notation, use a solid black pen between
# octaves (C0=row 127, C1=row 115 etc.)
def GetRowGridLinePen(self, row):

    if row % 12 == 7:
        return wx.Pen(wx.BLACK, 1, wx.SOLID)
    else:
        return self.GetDefaultGridLinePen()
Parameters

row (int) –

Return type

Pen



GetRowLabelAlignment(self)

Returns the alignment used for row labels.

Horizontal alignment will be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment will be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Return type

tuple

Returns

( horiz, vert )



GetRowLabelSize(self)

Returns the current width of the row labels.

Return type

int



GetRowLabelValue(self, row)

Returns the specified row label.

The default grid table class provides numeric row labels. If you are using a custom grid table you can override wx.grid.GridTableBase.GetRowLabelValue to provide your own labels.

Parameters

row (int) –

Return type

string



GetRowMinimalAcceptableHeight(self)

Returns the minimal size to which rows can be resized.

Use SetRowMinimalAcceptableHeight to change this value globally or SetRowMinimalHeight to do it for individual cells.

Return type

int



GetRowMinimalHeight(self, col)

Returns the minimal size for the given column.

The value returned by this function may be different from that returned by GetRowMinimalAcceptableHeight if SetRowMinimalHeight had been called for this row.

Parameters

col (int) –

Return type

int



GetRowSize(self, row)

Returns the height of the specified row.

Parameters

row (int) –

Return type

int



GetRowSizes(self)

Get size information for all row at once.

Return type

wx.grid.GridSizesInfo



GetScrollLineX(self)

Returns the number of pixels per horizontal scroll increment.

The default is 15.

Return type

int



GetScrollLineY(self)

Returns the number of pixels per vertical scroll increment.

The default is 15.

Return type

int



GetSelectedBlocks(self)

Returns a range of grid selection blocks.

The returned range can be iterated over, e.g. with C++11 range-for loop:

Return type

wx.grid.GridBlocks

New in version 4.1/wxWidgets-3.1.4.



GetSelectedCells(self)

Returns an array of individually selected cells.

Notice that this array does not contain all the selected cells in general as it doesn’t include the cells selected as part of column, row or block selection. You must use this method, GetSelectedCols , GetSelectedRows and GetSelectionBlockTopLeft and GetSelectionBlockBottomRight methods to obtain the entire selection in general.

Please notice this behaviour is by design and is needed in order to support grids of arbitrary size (when an entire column is selected in a grid with a million of columns, we don’t want to create an array with a million of entries in this function, instead it returns an empty array and GetSelectedCols returns an array containing one element).

The function can be slow for the big grids, use GetSelectedBlocks in the new code.

Return type

GridCellCoordsArray



GetSelectedCols(self)

Returns an array of selected columns.

Please notice that this method alone is not sufficient to find all the selected columns as it contains only the columns which were individually selected but not those being part of the block selection or being selected in virtue of all of their cells being selected individually, please see GetSelectedCells for more details.

The function can be slow for the big grids, use GetSelectedBlocks in the new code.

Return type

list of integers



GetSelectedRows(self)

Returns an array of selected rows.

Please notice that this method alone is not sufficient to find all the selected rows as it contains only the rows which were individually selected but not those being part of the block selection or being selected in virtue of all of their cells being selected individually, please see GetSelectedCells for more details.

The function can be slow for the big grids, use GetSelectedBlocks in the new code.

Return type

list of integers



GetSelectionBackground(self)

Returns the colour used for drawing the selection background.

Return type

Colour



GetSelectionBlockBottomRight(self)

Returns an array of the bottom right corners of blocks of selected cells.

Please see GetSelectedCells for more information about the selection representation in wx.grid.Grid.

The function can be slow for the big grids, use GetSelectedBlocks in the new code.

Return type

GridCellCoordsArray



GetSelectionBlockTopLeft(self)

Returns an array of the top left corners of blocks of selected cells.

Please see GetSelectedCells for more information about the selection representation in wx.grid.Grid.

The function can be slow for the big grids, use GetSelectedBlocks in the new code.

Return type

GridCellCoordsArray



GetSelectionForeground(self)

Returns the colour used for drawing the selection foreground.

Return type

Colour



GetSelectionMode(self)

Returns the current selection mode.

Return type

wx.grid.Grid.GridSelectionModes

See also

SetSelectionMode .



GetSortingColumn(self)

Return the column in which the sorting indicator is currently displayed.

Returns NOT_FOUND if sorting indicator is not currently displayed at all.

Return type

int

See also

SetSortingColumn



GetTable(self)

Returns a base pointer to the current table object.

The returned pointer is still owned by the grid.

Return type

wx.grid.GridTableBase



GoToCell(self, *args, **kw)

Make the given cell current and ensure it is visible.

This method is equivalent to calling MakeCellVisible and SetGridCursor and so, as with the latter, a wxEVT_GRID_SELECT_CELL event is generated by it and the selected cell doesn’t change if the event is vetoed.

overload Overloaded Implementations:



GoToCell (self, row, col)

Parameters
  • row (int) –

  • col (int) –



GoToCell (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –





GridLinesEnabled(self)

Returns True if drawing of grid lines is turned on, False otherwise.

Return type

bool



HideCellEditControl(self)

Hides the in-place cell edit control.



HideCol(self, col)

Hides the specified column.

To show the column later you need to call SetColSize with non-0 width or ShowCol to restore the previous column width.

If the column is already hidden, this method doesn’t do anything.

Parameters

col (int) – The column index.



HideColLabels(self)

Hides the column labels by calling SetColLabelSize with a size of 0.

The labels can be shown again by calling SetColLabelSize with a height greater than 0.

Note that when the column labels are hidden, the grid won’t have any visible border on the top side, which may result in a less than ideal appearance. Because of this, you may want to create the grid window with a border style, such as BORDER_SIMPLE , when you don’t plan to show the column labels for it.

See also

HideRowLabels



HideRow(self, col)

Hides the specified row.

To show the row later you need to call SetRowSize with non-0 width or ShowRow to restore its original height.

If the row is already hidden, this method doesn’t do anything.

Parameters

col (int) – The row index.



HideRowLabels(self)

Hides the row labels by calling SetRowLabelSize with a size of 0.

The labels can be shown again by calling SetRowLabelSize with a width greater than 0.

See HideColLabels for a note explaining why you may want to use a border with a grid without the row labels.



InsertCols(self, pos=0, numCols=1, updateLabels=True)

Inserts one or more new columns into a grid with the first new column at the specified position.

Notice that inserting the columns in the grid requires grid table cooperation: when this method is called, grid object begins by requesting the underlying grid table to insert new columns. If this is successful the table notifies the grid and the grid updates the display. For a default grid (one where you have called CreateGrid ) this process is automatic. If you are using a custom grid table (specified with SetTable or AssignTable ) then you must override wx.grid.GridTableBase.InsertCols in your derived table class.

Parameters
  • pos (int) – The position which the first newly inserted column will have.

  • numCols (int) – The number of columns to insert.

  • updateLabels (bool) – Currently not used.

Return type

bool

Returns

True if the columns were successfully inserted, False if an error occurred (most likely the table couldn’t be updated).



InsertRows(self, pos=0, numRows=1, updateLabels=True)

Inserts one or more new rows into a grid with the first new row at the specified position.

Notice that you must implement wx.grid.GridTableBase.InsertRows if you use a grid with a custom table, please see InsertCols for more information.

Parameters
  • pos (int) – The position which the first newly inserted row will have.

  • numRows (int) – The number of rows to insert.

  • updateLabels (bool) – Currently not used.

Return type

bool

Returns

True if the rows were successfully inserted, False if an error occurred (most likely the table couldn’t be updated).



IsCellEditControlEnabled(self)

Returns True if the in-place edit control is currently enabled.

Return type

bool



IsCellEditControlShown(self)

Returns True if the in-place edit control is currently shown.

Return type

bool



IsColShown(self, col)

Returns True if the specified column is not currently hidden.

Parameters

col (int) –

Return type

bool



IsCurrentCellReadOnly(self)

Returns True if the current cell is read-only.

Return type

bool

See also

SetReadOnly , IsReadOnly



IsEditable(self)

Returns False if the whole grid has been set as read-only or True otherwise.

See EnableEditing for more information about controlling the editing status of grid cells.

Return type

bool



IsInSelection(self, *args, **kw)

Returns True if the given cell is selected.

overload Overloaded Implementations:



IsInSelection (self, row, col)

Parameters
  • row (int) –

  • col (int) –

Return type

bool



IsInSelection (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –

Return type

bool





IsReadOnly(self, row, col)

Returns True if the cell at the specified location can’t be edited.

Parameters
  • row (int) –

  • col (int) –

Return type

bool



IsRowShown(self, row)

Returns True if the specified row is not currently hidden.

Parameters

row (int) –

Return type

bool



IsSelection(self)

Returns True if there are currently any selected cells, rows, columns or blocks.

Return type

bool



IsSortOrderAscending(self)

Return True if the current sorting order is ascending or False if it is descending.

It only makes sense to call this function if GetSortingColumn returns a valid column index and not NOT_FOUND .

Return type

bool

See also

SetSortingColumn



IsSortingBy(self, col)

Return True if this column is currently used for sorting.

Parameters

col (int) –

Return type

bool

See also

GetSortingColumn



IsUsingNativeHeader(self)

Return True if native header control is currently being used.

Return type

bool

New in version 4.1/wxWidgets-3.1.4.



IsVisible(self, *args, **kw)

Returns True if a cell is either entirely or at least partially visible in the grid window.

By default, the cell must be entirely visible for this function to return True but if wholeCellVisible is False, the function returns True even if the cell is only partially visible.

overload Overloaded Implementations:



IsVisible (self, row, col, wholeCellVisible=True)

Parameters
  • row (int) –

  • col (int) –

  • wholeCellVisible (bool) –

Return type

bool



IsVisible (self, coords, wholeCellVisible=True)

Parameters
Return type

bool





MakeCellVisible(self, *args, **kw)

Brings the specified cell into the visible grid cell area with minimal scrolling.

Does nothing if the cell is already visible.

overload Overloaded Implementations:



MakeCellVisible (self, row, col)

Parameters
  • row (int) –

  • col (int) –



MakeCellVisible (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –





MoveCursorDown(self, expandSelection)

Moves the grid cursor down by one row.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorDownBlock(self, expandSelection)

Moves the grid cursor down in the current column such that it skips to the beginning or end of a block of non-empty cells.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorLeft(self, expandSelection)

Moves the grid cursor left by one column.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorLeftBlock(self, expandSelection)

Moves the grid cursor left in the current row such that it skips to the beginning or end of a block of non-empty cells.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorRight(self, expandSelection)

Moves the grid cursor right by one column.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorRightBlock(self, expandSelection)

Moves the grid cursor right in the current row such that it skips to the beginning or end of a block of non-empty cells.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorUp(self, expandSelection)

Moves the grid cursor up by one row.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MoveCursorUpBlock(self, expandSelection)

Moves the grid cursor up in the current column such that it skips to the beginning or end of a block of non-empty cells.

If a block of cells was previously selected it will expand if the argument is True or be cleared if the argument is False.

Parameters

expandSelection (bool) –

Return type

bool



MovePageDown(self)

Moves the grid cursor down by some number of rows so that the previous bottom visible row becomes the top visible row.

Return type

bool



MovePageUp(self)

Moves the grid cursor up by some number of rows so that the previous top visible row becomes the bottom visible row.

Return type

bool



ProcessTableMessage(self, msg)

Receive and handle a message from the table.

Parameters

msg (wx.grid.GridTableMessage) –

Return type

bool



RefreshAttr(self, row, col)

Invalidates the cached attribute for the given cell.

For efficiency reasons, wx.grid.Grid may cache the recently used attributes (currently it caches only the single most recently used one, in fact) which can result in the cell appearance not being refreshed even when the attribute returned by your custom GridCellAttrProvider-derived class has changed. To force the grid to refresh the cell attribute, this function may be used. Notice that calling it will not result in actually redrawing the cell, you still need to call wx.Window.RefreshRect to invalidate the area occupied by the cell in the window to do this. Also note that you don’t need to call this function if you store the attributes in wx.grid.Grid itself, i.e. use its SetAttr and similar methods, it is only useful when using a separate custom attributes provider.

Parameters
  • row (int) – The row of the cell whose attribute needs to be queried again.

  • col (int) – The column of the cell whose attribute needs to be queried again.

New in version 2.9.2.



RegisterDataType(self, typeName, renderer, editor)

Register a new data type.

The data types allow to naturally associate specific renderers and editors to the cells containing values of the given type. For example, the grid automatically registers a data type with the name GRID_VALUE_STRING which uses wx.grid.GridCellStringRenderer and wx.grid.GridCellTextEditor as its renderer and editor respectively – this is the data type used by all the cells of the default wx.grid.GridStringTable, so this renderer and editor are used by default for all grid cells.

However if a custom table returns GRID_VALUE_BOOL from its wx.grid.GridTableBase.GetTypeName method, then wx.grid.GridCellBoolRenderer and wx.grid.GridCellBoolEditor are used for it because the grid also registers a boolean data type with this name.

And as this mechanism is completely generic, you may register your own data types using your own custom renderers and editors. Just remember that the table must identify a cell as being of the given type for them to be used for this cell.

Parameters
  • typeName (string) – Name of the new type. May be any string, but if the type name is the same as the name of an already registered type, including one of the standard ones (which are GRID_VALUE_STRING , GRID_VALUE_BOOL , GRID_VALUE_NUMBER , GRID_VALUE_FLOAT , GRID_VALUE_CHOICE and GRID_VALUE_DATE ), then the new registration information replaces the previously used renderer and editor.

  • renderer (wx.grid.GridCellRenderer) – The renderer to use for the cells of this type. Its ownership is taken by the grid, i.e. it will call DecRef() on this pointer when it doesn’t need it any longer.

  • editor (wx.grid.GridCellEditor) – The editor to use for the cells of this type. Its ownership is also taken by the grid.



Render(self, dc, pos=DefaultPosition, size=DefaultSize, topLeft=GridCellCoords(-1, -1), bottomRight=GridCellCoords(-1, -1), style=GRID_DRAW_DEFAULT)

Draws part or all of a wx.grid.Grid on a wx.DC for printing or display.

Pagination can be accomplished by using sequential Render calls with appropriate values in wx.grid.GridCellCoords topLeft and bottomRight.

Parameters
  • dc (wx.DC) – The wx.DC to be drawn on.

  • pos (wx.Point) – The position on the wx.DC where rendering should begin. If not specified drawing will begin at the wx.DC MaxX() and MaxY().

  • size (wx.Size) – The size of the area on the wx.DC that the rendered wx.grid.Grid should occupy. If not specified the drawing will be scaled to fit the available dc width or height. The wx.grid.Grid’s aspect ratio is maintained whether or not size is specified.

  • topLeft (wx.grid.GridCellCoords) – The top left cell of the block to be drawn. Defaults to ( 0, 0 ).

  • bottomRight (wx.grid.GridCellCoords) – The bottom right cell of the block to be drawn. Defaults to row and column counts.

  • style (int) – A combination of values from GridRenderStyle.

New in version 2.9.4.



ResetColPos(self)

Resets the position of the columns to the default.



SaveEditControlValue(self)

Sets the value of the current grid cell to the current in-place edit control value.

This is called automatically when the grid cursor moves from the current cell to a new cell. It is also a good idea to call this function when closing a grid since any edits to the final cell location will not be saved otherwise.



SelectAll(self)

Selects all cells in the grid.



SelectBlock(self, *args, **kw)

Selects a rectangular block of cells.

If addToSelected is False then any existing selection will be deselected; if True the column will be added to the existing selection.

overload Overloaded Implementations:



SelectBlock (self, topRow, leftCol, bottomRow, rightCol, addToSelected=False)

Parameters
  • topRow (int) –

  • leftCol (int) –

  • bottomRow (int) –

  • rightCol (int) –

  • addToSelected (bool) –



SelectBlock (self, topLeft, bottomRight, addToSelected=False)

Parameters





SelectCol(self, col, addToSelected=False)

Selects the specified column.

If addToSelected is False then any existing selection will be deselected; if True the column will be added to the existing selection.

This method won’t select anything if the current selection mode is GridSelectRows.

Parameters
  • col (int) –

  • addToSelected (bool) –



SelectRow(self, row, addToSelected=False)

Selects the specified row.

If addToSelected is False then any existing selection will be deselected; if True the row will be added to the existing selection.

This method won’t select anything if the current selection mode is GridSelectColumns.

Parameters
  • row (int) –

  • addToSelected (bool) –



SetAttr(self, row, col, attr)

Sets the cell attributes for the specified cell.

The grid takes ownership of the attribute pointer.

See the wx.grid.GridCellAttr class for more information about controlling cell attributes.

Parameters


SetCellAlignment(self, row, col, horiz, vert)

Sets the horizontal and vertical alignment for grid cell text at the specified location.

Horizontal alignment should be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT .

Vertical alignment should be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • row (int) –

  • col (int) –

  • horiz (int) –

  • vert (int) –



SetCellBackgroundColour(self, row, col, colour)

Set the background colour for the given cell or all cells by default.

Parameters
  • row (int) –

  • col (int) –

  • colour (wx.Colour) –



SetCellEditor(self, row, col, editor)

Sets the editor for the grid cell at the specified location.

The grid will take ownership of the pointer.

See wx.grid.GridCellEditor and the Grid Overview for more information about cell editors and renderers.

Parameters


SetCellFitMode(self, row, col, fitMode)

Specifies the behaviour of the cell contents if it doesn’t fit into the available space.

Parameters

New in version 4.1/wxWidgets-3.1.4.



SetCellFont(self, row, col, font)

Sets the font for text in the grid cell at the specified location.

Parameters
  • row (int) –

  • col (int) –

  • font (wx.Font) –



SetCellHighlightColour(self)
Parameters

`` (wx.Colour) –



SetCellHighlightPenWidth(self, width)
Parameters

width (int) –



SetCellHighlightROPenWidth(self, width)
Parameters

width (int) –



SetCellOverflow(self, row, col, allow)

Sets the overflow permission of the cell.

Prefer using SetCellFitMode in the new code.

Parameters
  • row (int) –

  • col (int) –

  • allow (bool) –



SetCellRenderer(self, row, col, renderer)

Sets the renderer for the grid cell at the specified location.

The grid will take ownership of the pointer.

See wx.grid.GridCellRenderer and the Grid Overview for more information about cell editors and renderers.

Parameters


SetCellSize(self, row, col, num_rows, num_cols)

Set the size of the cell.

Specifying a value of more than 1 in num_rows or num_cols will make the cell at (row, col) span the block of the specified size, covering the other cells which would be normally shown in it. Passing 1 for both arguments resets the cell to normal appearance.

Parameters
  • row (int) – The row of the cell.

  • col (int) – The column of the cell.

  • num_rows (int) – Number of rows to be occupied by this cell, must be >= 1.

  • num_cols (int) – Number of columns to be occupied by this cell, must be >= 1.

See also

GetCellSize



SetCellTextColour(self, row, col, colour)

Sets the text colour for the given cell.

Parameters
  • row (int) –

  • col (int) –

  • colour (wx.Colour) –



SetCellValue(self, *args, **kw)

Sets the string value for the cell at the specified location.

For simple applications where a grid object automatically uses a default grid table of string values you use this function together with GetCellValue to access cell values. For more complex applications where you have derived your own grid table class that contains various data types (e.g. numeric, boolean or user-defined custom types) then you only use this function for those cells that contain string values.

See wx.grid.GridTableBase.CanSetValueAs and the Grid Overview for more information.

overload Overloaded Implementations:



SetCellValue (self, row, col, s)

Parameters
  • row (int) –

  • col (int) –

  • s (string) –



SetCellValue (self, coords, s)

Parameters





SetColAttr(self, col, attr)

Sets the cell attributes for all cells in the specified column.

For more information about controlling grid cell attributes see the wx.grid.GridCellAttr cell attribute class and the Grid Overview.

Parameters


SetColFormatBool(self, col)

Sets the specified column to display boolean values.

Parameters

col (int) –



SetColFormatCustom(self, col, typeName)

Sets the specified column to display data in a custom format.

This method provides an alternative to defining a custom grid table which would return typeName from its GetTypeName() method for the cells in this column: while it doesn’t really change the type of the cells in this column, it does associate the renderer and editor used for the cells of the specified type with them.

See the Grid Overview for more information on working with custom data types.

Parameters
  • col (int) –

  • typeName (string) –



SetColFormatDate(self, col, format="")

Sets the specified column to display date values.

The format argument is used with wx.grid.GridCellDateRenderer and allows to specify the strftime-like format string to use for displaying the dates in this column.

Parameters
  • col (int) –

  • format (string) –

New in version 4.1/wxWidgets-3.1.3.



SetColFormatFloat(self, col, width=-1, precision=-1)

Sets the specified column to display floating point values with the given width and precision.

Parameters
  • col (int) –

  • width (int) –

  • precision (int) –



SetColFormatNumber(self, col)

Sets the specified column to display integer values.

Parameters

col (int) –



SetColLabelAlignment(self, horiz, vert)

Sets the horizontal and vertical alignment of column label text.

Horizontal alignment should be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT . Vertical alignment should be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • horiz (int) –

  • vert (int) –



SetColLabelSize(self, height)

Sets the height of the column labels.

If height equals to GRID_AUTOSIZE then height is calculated automatically so that no label is truncated. Note that this could be slow for a large table.

Parameters

height (int) –



SetColLabelTextOrientation(self, textOrientation)

Sets the orientation of the column labels (either HORIZONTAL or VERTICAL ).

Parameters

textOrientation (int) –



SetColLabelValue(self, col, value)

Set the value for the given column label.

If you are using a custom grid table you must override wx.grid.GridTableBase.SetColLabelValue for this to have any effect.

Parameters
  • col (int) –

  • value (string) –



SetColMinimalAcceptableWidth(self, width)

Sets the minimal width to which the user can resize columns.

Parameters

width (int) –



SetColMinimalWidth(self, col, width)

Sets the minimal width for the specified column col.

It is usually best to call this method during grid creation as calling it later will not resize the column to the given minimal width even if it is currently narrower than it.

width must be greater than the minimal acceptable column width as returned by GetColMinimalAcceptableWidth .

Parameters
  • col (int) –

  • width (int) –



SetColPos(self, colID, newPos)

Sets the position of the specified column.

Parameters
  • colID (int) –

  • newPos (int) –



SetColSize(self, col, width)

Sets the width of the specified column.

Parameters
  • col (int) – The column index.

  • width (int) – The new column width in pixels, 0 to hide the column or -1 to fit the column width to its label width.



SetColSizes(self, sizeInfo)

Restore all columns sizes.

This is usually called with wx.grid.GridSizesInfo object previously returned by GetColSizes .

Parameters

sizeInfo (wx.grid.GridSizesInfo) –

See also

SetRowSizes



SetColumnsOrder(self, order)

Sets the positions of all columns at once.

This method takes an array containing the indices of the columns in their display order, i.e. uses the same convention as wx.HeaderCtrl.SetColumnsOrder .

Parameters

order (list of integers) –



SetCornerLabelAlignment(self, horiz, vert)

Sets the horizontal and vertical alignment of the (top-left) corner label text.

Horizontal alignment should be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT . Vertical alignment should be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • horiz (int) –

  • vert (int) –

New in version 4.1/wxWidgets-3.1.2.



SetCornerLabelTextOrientation(self, textOrientation)

Sets the orientation of the (top-left) corner label (either HORIZONTAL or VERTICAL ).

Parameters

textOrientation (int) –

New in version 4.1/wxWidgets-3.1.2.



SetCornerLabelValue(self)

Set the value for the (top-left) corner label.

If you are using a custom grid table you must override wx.grid.GridTableBase.SetCornerLabelValue for this to have any effect.

Parameters

`` (string) –

New in version 4.1/wxWidgets-3.1.2.



SetDefaultCellAlignment(self, horiz, vert)

Sets the default horizontal and vertical alignment for grid cell text.

Horizontal alignment should be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT . Vertical alignment should be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • horiz (int) –

  • vert (int) –



SetDefaultCellBackgroundColour(self, colour)

Sets the default background colour for grid cells.

Parameters

colour (wx.Colour) –



SetDefaultCellFitMode(self, fitMode)

Specifies the default behaviour of the cell contents if it doesn’t fit into the available space.

Parameters

fitMode (wx.grid.GridFitMode) –

New in version 4.1/wxWidgets-3.1.4.



SetDefaultCellFont(self, font)

Sets the default font to be used for grid cell text.

Parameters

font (wx.Font) –



SetDefaultCellOverflow(self, allow)

Sets the default overflow permission of the cells.

Prefer using SetDefaultCellFitMode in the new code.

Parameters

allow (bool) –



SetDefaultCellTextColour(self, colour)

Sets the current default colour for grid cell text.

Parameters

colour (wx.Colour) –



SetDefaultColSize(self, width, resizeExistingCols=False)

Sets the default width for columns in the grid.

This will only affect columns subsequently added to the grid unless resizeExistingCols is True.

If width is less than GetColMinimalAcceptableWidth , then the minimal acceptable width is used instead of it.

Parameters
  • width (int) –

  • resizeExistingCols (bool) –



SetDefaultEditor(self, editor)

Sets the default editor for grid cells.

The grid will take ownership of the pointer.

See wx.grid.GridCellEditor and the Grid Overview for more information about cell editors and renderers.

Parameters

editor (wx.grid.GridCellEditor) –



SetDefaultRenderer(self, renderer)

Sets the default renderer for grid cells.

The grid will take ownership of the pointer.

See wx.grid.GridCellRenderer and the Grid Overview for more information about cell editors and renderers.

Parameters

renderer (wx.grid.GridCellRenderer) –



SetDefaultRowSize(self, height, resizeExistingRows=False)

Sets the default height for rows in the grid.

This will only affect rows subsequently added to the grid unless resizeExistingRows is True.

If height is less than GetRowMinimalAcceptableHeight , then the minimal acceptable height is used instead of it.

Parameters
  • height (int) –

  • resizeExistingRows (bool) –



SetGridCursor(self, *args, **kw)

Set the grid cursor to the specified cell.

The grid cursor indicates the current cell and can be moved by the user using the arrow keys or the mouse.

Calling this function generates a wxEVT_GRID_SELECT_CELL event and if the event handler vetoes this event, the cursor is not moved.

This function doesn’t make the target call visible, use GoToCell to do this.

overload Overloaded Implementations:



SetGridCursor (self, row, col)

Parameters
  • row (int) –

  • col (int) –



SetGridCursor (self, coords)

Parameters

coords (wx.grid.GridCellCoords) –





SetGridFrozenBorderColour(self)
Parameters

`` (wx.Colour) –



SetGridFrozenBorderPenWidth(self, width)
Parameters

width (int) –



SetGridLineColour(self, colour)

Sets the colour used to draw grid lines.

Parameters

colour (wx.Colour) –



SetLabelBackgroundColour(self, colour)

Sets the background colour for row and column labels.

Parameters

colour (wx.Colour) –



SetLabelFont(self, font)

Sets the font for row and column labels.

Parameters

font (wx.Font) –



SetLabelTextColour(self, colour)

Sets the colour for row and column label text.

Parameters

colour (wx.Colour) –



SetMargins(self, extraWidth, extraHeight)

Sets the extra margins used around the grid area.

A grid may occupy more space than needed for its data display and this function allows setting how big this extra space is

Parameters
  • extraWidth (int) –

  • extraHeight (int) –



SetReadOnly(self, row, col, isReadOnly=True)

Makes the cell at the specified location read-only or editable.

Parameters
  • row (int) –

  • col (int) –

  • isReadOnly (bool) –

See also

IsReadOnly



SetRowAttr(self, row, attr)

Sets the cell attributes for all cells in the specified row.

The grid takes ownership of the attribute pointer.

See the wx.grid.GridCellAttr class for more information about controlling cell attributes.

Parameters


SetRowLabelAlignment(self, horiz, vert)

Sets the horizontal and vertical alignment of row label text.

Horizontal alignment should be one of ALIGN_LEFT , ALIGN_CENTRE or ALIGN_RIGHT . Vertical alignment should be one of ALIGN_TOP , ALIGN_CENTRE or ALIGN_BOTTOM .

Parameters
  • horiz (int) –

  • vert (int) –



SetRowLabelSize(self, width)

Sets the width of the row labels.

If width equals GRID_AUTOSIZE then width is calculated automatically so that no label is truncated. Note that this could be slow for a large table.

Parameters

width (int) –



SetRowLabelValue(self, row, value)

Sets the value for the given row label.

If you are using a derived grid table you must override wx.grid.GridTableBase.SetRowLabelValue for this to have any effect.

Parameters
  • row (int) –

  • value (string) –



SetRowMinimalAcceptableHeight(self, height)

Sets the minimal row height used by default.

See SetColMinimalAcceptableWidth for more information.

Parameters

height (int) –



SetRowMinimalHeight(self, row, height)

Sets the minimal height for the specified row.

See SetColMinimalWidth for more information.

Parameters
  • row (int) –

  • height (int) –



SetRowSize(self, row, height)

Sets the height of the specified row.

See SetColSize for more information.

Parameters
  • row (int) –

  • height (int) –



SetRowSizes(self, sizeInfo)

Restore all rows sizes.

Parameters

sizeInfo (wx.grid.GridSizesInfo) –

See also

SetColSizes



SetScrollLineX(self, x)

Sets the number of pixels per horizontal scroll increment.

The default is 15.

Parameters

x (int) –



SetScrollLineY(self, y)

Sets the number of pixels per vertical scroll increment.

The default is 15.

Parameters

y (int) –



SetSelectionBackground(self, c)

Set the colour to be used for drawing the selection background.

Parameters

c (wx.Colour) –



SetSelectionForeground(self, c)

Set the colour to be used for drawing the selection foreground.

Parameters

c (wx.Colour) –



SetSelectionMode(self, selmode)

Set the selection behaviour of the grid.

The existing selection is converted to conform to the new mode if possible and discarded otherwise (e.g. any individual selected cells are deselected if the new mode allows only the selection of the entire rows or columns).

Parameters

selmode (GridSelectionModes) –



SetSortingColumn(self, col, ascending=True)

Set the column to display the sorting indicator in and its direction.

Parameters
  • col (int) – The column to display the sorting indicator in or NOT_FOUND to remove any currently displayed sorting indicator.

  • ascending (bool) – If True, display the ascending sort indicator, otherwise display the descending sort indicator.



SetTabBehaviour(self, behaviour)

Set the grid’s behaviour when the user presses the TAB key.

Pressing the TAB key moves the grid cursor right in the current row, if there is a cell at the right and, similarly, Shift-TAB moves the cursor to the left in the current row if it’s not in the first column.

What happens if the cursor can’t be moved because it it’s already at the beginning or end of the row can be configured using this function, see wx.grid.Grid.TabBehaviour documentation for the detailed description.

IF none of the standard behaviours is appropriate, you can always handle wxEVT_GRID_TABBING event directly to implement a custom TAB-handling logic.

Parameters

behaviour (TabBehaviour) –

New in version 2.9.5.



_SetTable(self, table, takeOwnership=False, selmode=GridSelectCells)

Passes a pointer to a custom grid table to be used by the grid.

This should be called after the grid constructor and before using the grid object. If takeOwnership is set to True then the table will be deleted by the wx.grid.Grid destructor.

Use this function instead of CreateGrid when your application involves complex or non-string data or data sets that are too large to fit wholly in memory.

When the custom table should be owned by the grid, consider using the simpler AssignTable function instead of this one with True value of takeOwnership parameter.

Parameters
Return type

bool



SetTable(self, table, takeOwnership=False, selmode=Grid.GridSelectCells)

Set the Grid Table to be used by this grid.



SetUseNativeColLabels(self, native=True)

Call this in order to make the column labels use a native look by using wx.RendererNative.DrawHeaderButton internally.

There is no equivalent method for drawing row columns as there is not native look for that. This option is useful when using wx.grid.Grid for displaying tables and not as a spread-sheet.

Parameters

native (bool) –



ShowCellEditControl(self)

Displays the active in-place cell edit control for the current cell after it was hidden.

Note that this method does not start editing the cell, this is only done by EnableCellEditControl .



ShowCol(self, col)

Shows the previously hidden column by resizing it to non-0 size.

The column is shown again with the same width that it had before HideCol call.

If the column is currently shown, this method doesn’t do anything.

Parameters

col (int) –

See also

HideCol , SetColSize



ShowRow(self, col)

Shows the previously hidden row.

The row is shown again with the same height that it had before HideRow call.

If the row is currently shown, this method doesn’t do anything.

Parameters

col (int) –

See also

HideRow , SetRowSize



UnsetSortingColumn(self)

Remove any currently shown sorting indicator.

This is equivalent to calling SetSortingColumn with NOT_FOUND first argument.



UseNativeColHeader(self, native=True)

Enable the use of native header window for column labels.

If this function is called with True argument, a wx.HeaderCtrl is used instead to display the column labels instead of drawing them in wx.grid.Grid code itself. This has the advantage of making the grid look and feel perfectly the same as native applications (using SetUseNativeColLabels the grid can be made to look more natively but it still doesn’t feel natively, notably the column resizing and dragging still works slightly differently as it is implemented in wxWidgets itself) but results in different behaviour for column and row headers, for which there is no equivalent function, and, most importantly, is unsuitable for grids with huge numbers of columns as wx.HeaderCtrl doesn’t support virtual mode. Because of this, by default the grid does not use the native header control but you should call this function to enable it if you are using the grid to display tabular data and don’t have thousands of columns in it.

Another difference between the default behaviour and the native header behaviour is that the latter provides the user with a context menu (which appears on right clicking the header) allowing to rearrange the grid columns if CanDragColMove returns True. If you want to prevent this from happening for some reason, you need to define a handler for wxEVT_GRID_LABEL_RIGHT_CLICK event which simply does nothing (in particular doesn’t skip the event) as this will prevent the default right click handling from working.

Also note that currently wxEVT_GRID_LABEL_RIGHT_DCLICK event is not generated for the column labels if the native columns header is used (but this limitation could possibly be lifted in the future).

Finally, please note that using the native control is currently incompatible with freezing columns in the grid (see FreezeTo ) and this function will return False, without doing anything, if it’s called on a grid in which any columns are frozen.

Parameters

native (bool) –

Return type

bool



XToCol(self, x, clipToMinMax=False, gridWindow=None)

Returns the column at the given pixel position depending on the window.

Parameters
  • x (int) – The x position to evaluate.

  • clipToMinMax (bool) – If True, rather than returning NOT_FOUND , it returns either the first or last column depending on whether x is too far to the left or right respectively.

  • gridWindow (wx.grid.GridWindow) – The associated grid window that limits the search (note that this parameter is only available since wxWidgets 3.1.3). If gridWindow is None, it will consider all the cells, no matter which grid they belong to.

Return type

int

Returns

The column index or NOT_FOUND .



XToEdgeOfCol(self, x)

Returns the column whose right hand edge is close to the given logical x position.

If no column edge is near to this position NOT_FOUND is returned.

Parameters

x (int) –

Return type

int



XYToCell(self, *args, **kw)

overload Overloaded Implementations:



XYToCell (self, x, y, gridWindow=None)

Translates logical pixel coordinates to the grid cell coordinates.

Notice that this function expects logical coordinates on input so if you use this function in a mouse event handler you need to translate the mouse position, which is expressed in device coordinates, to logical ones.

The parameter gridWindow is new since wxWidgets 3.1.3. If it is specified, i.e. not None, the coordinates must be in this window coordinate system and only the cells of this window are considered, i.e. the function returns NOT_FOUND if the coordinates are out of bounds.

If gridWindow is None, coordinates are relative to the main grid window and all cells are considered.

Parameters
  • x (int) –

  • y (int) –

  • gridWindow (wx.grid.GridWindow) –

Return type

wx.grid.GridCellCoords

See also

XToCol , YToRow



XYToCell (self, pos, gridWindow=None)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
  • pos (wx.Point) –

  • gridWindow (wx.grid.GridWindow) –

Return type

wx.grid.GridCellCoords





YToEdgeOfRow(self, y)

Returns the row whose bottom edge is close to the given logical y position.

If no row edge is near to this position NOT_FOUND is returned.

Parameters

y (int) –

Return type

int



YToRow(self, y, clipToMinMax=False, gridWindow=None)

Returns the grid row that corresponds to the logical y coordinate.

The parameter gridWindow is new since wxWidgets 3.1.3. If it is specified, i.e. not None, only the cells of this window are considered, i.e. the function returns NOT_FOUND if y is out of bounds.

If gridWindow is None, the function returns NOT_FOUND only if there is no row at all at the y position.

Parameters
  • y (int) –

  • clipToMinMax (bool) –

  • gridWindow (wx.grid.GridWindow) –

Return type

int


Properties

BatchCount

See GetBatchCount



CellHighlightColour

See GetCellHighlightColour and SetCellHighlightColour



CellHighlightPenWidth

See GetCellHighlightPenWidth and SetCellHighlightPenWidth



CellHighlightROPenWidth

See GetCellHighlightROPenWidth and SetCellHighlightROPenWidth



ColLabelSize

See GetColLabelSize and SetColLabelSize



ColLabelTextOrientation

See GetColLabelTextOrientation and SetColLabelTextOrientation



ColMinimalAcceptableWidth

See GetColMinimalAcceptableWidth and SetColMinimalAcceptableWidth



ColSizes

See GetColSizes and SetColSizes



CornerLabelTextOrientation

See GetCornerLabelTextOrientation and SetCornerLabelTextOrientation



CornerLabelValue

See GetCornerLabelValue and SetCornerLabelValue



DefaultCellBackgroundColour

See GetDefaultCellBackgroundColour and SetDefaultCellBackgroundColour



DefaultCellFitMode

See GetDefaultCellFitMode and SetDefaultCellFitMode



DefaultCellFont

See GetDefaultCellFont and SetDefaultCellFont



DefaultCellOverflow

See GetDefaultCellOverflow and SetDefaultCellOverflow



DefaultCellTextColour

See GetDefaultCellTextColour and SetDefaultCellTextColour



DefaultColLabelSize

See GetDefaultColLabelSize



DefaultColSize

See GetDefaultColSize and SetDefaultColSize



DefaultEditor

See GetDefaultEditor and SetDefaultEditor



DefaultGridLinePen

See GetDefaultGridLinePen



DefaultRenderer

See GetDefaultRenderer and SetDefaultRenderer



DefaultRowLabelSize

See GetDefaultRowLabelSize



DefaultRowSize

See GetDefaultRowSize and SetDefaultRowSize



FirstFullyVisibleColumn

See GetFirstFullyVisibleColumn



FirstFullyVisibleRow

See GetFirstFullyVisibleRow



FrozenColGridWindow

See GetFrozenColGridWindow



FrozenCornerGridWindow

See GetFrozenCornerGridWindow



FrozenRowGridWindow

See GetFrozenRowGridWindow



GridColHeader

See GetGridColHeader



GridColLabelWindow

See GetGridColLabelWindow



GridCornerLabelWindow

See GetGridCornerLabelWindow



GridCursorCol

See GetGridCursorCol



GridCursorCoords

See GetGridCursorCoords



GridCursorRow

See GetGridCursorRow



GridLineColour

See GetGridLineColour and SetGridLineColour



GridRowLabelWindow

See GetGridRowLabelWindow



GridWindow

See GetGridWindow



LabelBackgroundColour

See GetLabelBackgroundColour and SetLabelBackgroundColour



LabelFont

See GetLabelFont and SetLabelFont



LabelTextColour

See GetLabelTextColour and SetLabelTextColour



NumberCols

See GetNumberCols



NumberFrozenCols

See GetNumberFrozenCols



NumberFrozenRows

See GetNumberFrozenRows



NumberRows

See GetNumberRows



RowLabelSize

See GetRowLabelSize and SetRowLabelSize



RowMinimalAcceptableHeight

See GetRowMinimalAcceptableHeight and SetRowMinimalAcceptableHeight



RowSizes

See GetRowSizes and SetRowSizes



ScrollLineX

See GetScrollLineX and SetScrollLineX



ScrollLineY

See GetScrollLineY and SetScrollLineY



SelectedBlocks

See GetSelectedBlocks



SelectedCells

See GetSelectedCells



SelectedCols

See GetSelectedCols



SelectedRows

See GetSelectedRows



SelectionBackground

See GetSelectionBackground and SetSelectionBackground



SelectionBlockBottomRight

See GetSelectionBlockBottomRight



SelectionBlockTopLeft

See GetSelectionBlockTopLeft



SelectionForeground

See GetSelectionForeground and SetSelectionForeground



SelectionMode

See GetSelectionMode and SetSelectionMode



SortingColumn

See GetSortingColumn and SetSortingColumn



Table

See GetTable and SetTable