.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.grid.Grid:

==========================================================================================================================================
|phoenix_title|  **wx.grid.Grid**
==========================================================================================================================================

:ref:`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, :ref:`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 :ref:`Grid Overview <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 :ref:`wx.grid.Grid`. 

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

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



- :ref:`wx.grid.GridCellBoolRenderer` 
- :ref:`wx.grid.GridCellFloatRenderer` 
- :ref:`wx.grid.GridCellNumberRenderer` 
- :ref:`wx.grid.GridCellStringRenderer` 




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

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



- :ref:`wx.grid.GridCellBoolEditor` 
- :ref:`wx.grid.GridCellChoiceEditor` 
- :ref:`wx.grid.GridCellFloatEditor` 
- :ref:`wx.grid.GridCellNumberEditor` 
- :ref:`wx.grid.GridCellTextEditor` 




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







         



.. seealso:: :ref:`Grid Overview <grid overview>`, :ref:`wx.grid.GridUpdateLocker`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Grid</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.grid.Grid_inheritance.png" alt="Inheritance diagram of Grid" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="Scrolled&lt; wxPanel &gt;.html" title="Scrolled&lt; wxPanel &gt;" alt="" coords="5,101,157,131"/> <area shape="rect" id="node3" href="wx.grid.Grid.html" title="wx.grid.Grid" alt="" coords="33,179,129,208"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.grid.Grid.__init__`                                                   Default constructor.
:meth:`~wx.grid.Grid.AppendCols`                                                 Appends one or more new columns to the right of the grid.
:meth:`~wx.grid.Grid.AppendRows`                                                 Appends one or more new rows to the bottom of the grid.
:meth:`~wx.grid.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.
:meth:`~wx.grid.Grid.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.
:meth:`~wx.grid.Grid.AutoSize`                                                   Automatically sets the height and width of all rows and columns to fit their contents.
:meth:`~wx.grid.Grid.AutoSizeColLabelSize`                                       Automatically adjusts width of the column to fit its label.
:meth:`~wx.grid.Grid.AutoSizeColumn`                                             Automatically sizes the column to fit its contents.
:meth:`~wx.grid.Grid.AutoSizeColumns`                                            Automatically sizes all columns to fit their contents.
:meth:`~wx.grid.Grid.AutoSizeRow`                                                Automatically sizes the row to fit its contents.
:meth:`~wx.grid.Grid.AutoSizeRowLabelSize`                                       Automatically adjusts height of the row to fit its label.
:meth:`~wx.grid.Grid.AutoSizeRows`                                               Automatically sizes all rows to fit their contents.
:meth:`~wx.grid.Grid.BeginBatch`                                                 Increments the grid's batch count.
:meth:`~wx.grid.Grid.BlockToDeviceRect`                                          Convert grid cell coordinates to grid window pixel coordinates.
:meth:`~wx.grid.Grid.CalcCellsExposed`                                           Appends one or more new columns to the right of the grid.
:meth:`~wx.grid.Grid.CalcColLabelsExposed`                                       Appends one or more new columns to the right of the grid.
:meth:`~wx.grid.Grid.CalcRowLabelsExposed`                                       Appends one or more new columns to the right of the grid.
:meth:`~wx.grid.Grid.CanDragCell`                                                Return ``True`` if the dragging of cells is enabled or ``False`` otherwise.
:meth:`~wx.grid.Grid.CanDragColMove`                                             Returns ``True`` if columns can be moved by dragging with the mouse.
:meth:`~wx.grid.Grid.CanDragColSize`                                             Returns ``True`` if the given column can be resized by dragging with the mouse.
:meth:`~wx.grid.Grid.CanDragGridSize`                                            Return ``True`` if the dragging of grid lines to resize rows and columns is enabled or ``False`` otherwise.
:meth:`~wx.grid.Grid.CanDragRowSize`                                             Returns ``True`` if the given row can be resized by dragging with the mouse.
:meth:`~wx.grid.Grid.CanEnableCellControl`                                       Returns ``True`` if the in-place edit control for the current grid cell can be used and ``False`` otherwise.
:meth:`~wx.grid.Grid.CanHaveAttributes`                                          Returns ``True`` if this grid has support for cell attributes.
:meth:`~wx.grid.Grid.CellToRect`                                                 Return the rectangle corresponding to the grid cell's size and position in logical coordinates.
:meth:`~wx.grid.Grid.ClearGrid`                                                  Clears all data in the underlying grid table and repaints the grid.
:meth:`~wx.grid.Grid.ClearSelection`                                             Deselects all cells that are currently selected.
:meth:`~wx.grid.Grid.ClipHorzGridLines`                                          Change whether the horizontal grid lines are clipped by the end of the last column.
:meth:`~wx.grid.Grid.ClipVertGridLines`                                          Change whether the vertical grid lines are clipped by the end of the last row.
:meth:`~wx.grid.Grid.Create`                                                     Creates the grid window for an object initialized using the default constructor.
:meth:`~wx.grid.Grid.CreateGrid`                                                 Creates a grid with the specified initial number of rows and columns.
:meth:`~wx.grid.Grid.DeleteCols`                                                 Deletes one or more columns from a grid starting at the specified position.
:meth:`~wx.grid.Grid.DeleteRows`                                                 Deletes one or more rows from a grid starting at the specified position.
:meth:`~wx.grid.Grid.DeselectCell`                                               Deselects a cell.
:meth:`~wx.grid.Grid.DeselectCol`                                                Deselects a column of cells.
:meth:`~wx.grid.Grid.DeselectRow`                                                Deselects a row of cells.
:meth:`~wx.grid.Grid.DisableCellEditControl`                                     Disables in-place editing of grid cells.
:meth:`~wx.grid.Grid.DisableColResize`                                           Disable interactive resizing of the specified column.
:meth:`~wx.grid.Grid.DisableDragColMove`                                         Disables column moving by dragging with the mouse.
:meth:`~wx.grid.Grid.DisableDragColSize`                                         Disables column sizing by dragging with the mouse.
:meth:`~wx.grid.Grid.DisableDragGridSize`                                        Disable mouse dragging of grid lines to resize rows and columns.
:meth:`~wx.grid.Grid.DisableDragRowSize`                                         Disables row sizing by dragging with the mouse.
:meth:`~wx.grid.Grid.DisableRowResize`                                           Disable interactive resizing of the specified row.
:meth:`~wx.grid.Grid.DrawCellHighlight`                                          
:meth:`~wx.grid.Grid.DrawColLabel`                                               
:meth:`~wx.grid.Grid.DrawColLabels`                                              
:meth:`~wx.grid.Grid.DrawCornerLabel`                                            
:meth:`~wx.grid.Grid.DrawRowLabel`                                               
:meth:`~wx.grid.Grid.DrawRowLabels`                                              
:meth:`~wx.grid.Grid.DrawTextRectangle`                                          
:meth:`~wx.grid.Grid.EnableCellEditControl`                                      Enables or disables in-place editing of grid cell data.
:meth:`~wx.grid.Grid.EnableDragCell`                                             Enables or disables cell dragging with the mouse.
:meth:`~wx.grid.Grid.EnableDragColMove`                                          Enables or disables column moving by dragging with the mouse.
:meth:`~wx.grid.Grid.EnableDragColSize`                                          Enables or disables column sizing by dragging with the mouse.
:meth:`~wx.grid.Grid.EnableDragGridSize`                                         Enables or disables row and column resizing by dragging gridlines with the mouse.
:meth:`~wx.grid.Grid.EnableDragRowSize`                                          Enables or disables row sizing by dragging with the mouse.
:meth:`~wx.grid.Grid.EnableEditing`                                              Makes the grid globally editable or read-only.
:meth:`~wx.grid.Grid.EnableGridLines`                                            Turns the drawing of grid lines on or off.
:meth:`~wx.grid.Grid.EndBatch`                                                   Decrements the grid's batch count.
:meth:`~wx.grid.Grid.Fit`                                                        Overridden :ref:`wx.Window`  method.
:meth:`~wx.grid.Grid.ForceRefresh`                                               Causes immediate repainting of the grid.
:meth:`~wx.grid.Grid.GetBatchCount`                                              Returns the number of times that :meth:`~Grid.BeginBatch`   has been called without (yet) matching calls to :meth:`~Grid.EndBatch` .
:meth:`~wx.grid.Grid.GetCellAlignment`                                           Sets the arguments to the horizontal and vertical text alignment values for the grid cell at the specified location.
:meth:`~wx.grid.Grid.GetCellBackgroundColour`                                    Returns the background colour of the cell at the specified location.
:meth:`~wx.grid.Grid.GetCellEditor`                                              Returns a pointer to the editor for the cell at the specified location.
:meth:`~wx.grid.Grid.GetCellFont`                                                Returns the font for text in the grid cell at the specified location.
:meth:`~wx.grid.Grid.GetCellHighlightColour`                                     
:meth:`~wx.grid.Grid.GetCellHighlightPenWidth`                                   
:meth:`~wx.grid.Grid.GetCellHighlightROPenWidth`                                 
:meth:`~wx.grid.Grid.GetCellOverflow`                                            Returns ``True`` if the cell value can overflow.
:meth:`~wx.grid.Grid.GetCellRenderer`                                            Returns a pointer to the renderer for the grid cell at the specified location.
:meth:`~wx.grid.Grid.GetCellSize`                                                Get the size of the cell in number of cells covered by it.
:meth:`~wx.grid.Grid.GetCellTextColour`                                          Returns the text colour for the grid cell at the specified location.
:meth:`~wx.grid.Grid.GetCellValue`                                               Returns the string contained in the cell at the specified location.
:meth:`~wx.grid.Grid.GetColAt`                                                   Returns the column ``ID`` of the specified column position.
:meth:`~wx.grid.Grid.GetColGridLinePen`                                          Returns the pen used for vertical grid lines.
:meth:`~wx.grid.Grid.GetColLabelAlignment`                                       Sets the arguments to the current column label alignment values.
:meth:`~wx.grid.Grid.GetColLabelSize`                                            Returns the current height of the column labels.
:meth:`~wx.grid.Grid.GetColLabelTextOrientation`                                 Returns the orientation of the column labels (either  ``HORIZONTAL``   or   ``VERTICAL`` ).
:meth:`~wx.grid.Grid.GetColLabelValue`                                           Returns the specified column label.
:meth:`~wx.grid.Grid.GetColLeft`                                                 Returns the coordinate of the left border specified column.
:meth:`~wx.grid.Grid.GetColMinimalAcceptableWidth`                               Returns the minimal width to which a column may be resized.
:meth:`~wx.grid.Grid.GetColMinimalWidth`                                         Get the minimal width of the given column/row.
:meth:`~wx.grid.Grid.GetColPos`                                                  Returns the position of the specified column.
:meth:`~wx.grid.Grid.GetColRight`                                                Returns the coordinate of the right border specified column.
:meth:`~wx.grid.Grid.GetColSize`                                                 Returns the width of the specified column.
:meth:`~wx.grid.Grid.GetColSizes`                                                Get size information for all columns at once.
:meth:`~wx.grid.Grid.GetDefaultCellAlignment`                                    Returns the default cell alignment.
:meth:`~wx.grid.Grid.GetDefaultCellBackgroundColour`                             Returns the current default background colour for grid cells.
:meth:`~wx.grid.Grid.GetDefaultCellFont`                                         Returns the current default font for grid cell text.
:meth:`~wx.grid.Grid.GetDefaultCellOverflow`                                     Returns ``True`` if the cells can overflow by default.
:meth:`~wx.grid.Grid.GetDefaultCellTextColour`                                   Returns the current default colour for grid cell text.
:meth:`~wx.grid.Grid.GetDefaultColLabelSize`                                     Returns the default height for column labels.
:meth:`~wx.grid.Grid.GetDefaultColSize`                                          Returns the current default width for grid columns.
:meth:`~wx.grid.Grid.GetDefaultEditor`                                           Returns a pointer to the current default grid cell editor.
:meth:`~wx.grid.Grid.GetDefaultEditorForCell`                                    Returns the default editor for the specified cell.
:meth:`~wx.grid.Grid.GetDefaultEditorForType`                                    Returns the default editor for the cells containing values of the given type.
:meth:`~wx.grid.Grid.GetDefaultGridLinePen`                                      Returns the pen used for grid lines.
:meth:`~wx.grid.Grid.GetDefaultRenderer`                                         Returns a pointer to the current default grid cell renderer.
:meth:`~wx.grid.Grid.GetDefaultRendererForCell`                                  Returns the default renderer for the given cell.
:meth:`~wx.grid.Grid.GetDefaultRendererForType`                                  Returns the default renderer for the cell containing values of the given type.
:meth:`~wx.grid.Grid.GetDefaultRowLabelSize`                                     Returns the default width for the row labels.
:meth:`~wx.grid.Grid.GetDefaultRowSize`                                          Returns the current default height for grid rows.
:meth:`~wx.grid.Grid.GetGridColHeader`                                           Return the header control used for column labels display.
:meth:`~wx.grid.Grid.GetGridColLabelWindow`                                      Return the column labels window.
:meth:`~wx.grid.Grid.GetGridCornerLabelWindow`                                   Return the window in the top left grid corner.
:meth:`~wx.grid.Grid.GetGridCursorCol`                                           Returns the current grid cell column position.
:meth:`~wx.grid.Grid.GetGridCursorRow`                                           Returns the current grid cell row position.
:meth:`~wx.grid.Grid.GetGridLineColour`                                          Returns the colour used for grid lines.
:meth:`~wx.grid.Grid.GetGridRowLabelWindow`                                      Return the row labels window.
:meth:`~wx.grid.Grid.GetGridWindow`                                              Return the main grid window containing the grid cells.
:meth:`~wx.grid.Grid.GetLabelBackgroundColour`                                   Returns the colour used for the background of row and column labels.
:meth:`~wx.grid.Grid.GetLabelFont`                                               Returns the font used for row and column labels.
:meth:`~wx.grid.Grid.GetLabelTextColour`                                         Returns the colour used for row and column label text.
:meth:`~wx.grid.Grid.GetNumberCols`                                              Returns the total number of grid columns.
:meth:`~wx.grid.Grid.GetNumberRows`                                              Returns the total number of grid rows.
:meth:`~wx.grid.Grid.GetOrCreateCellAttr`                                        Returns the attribute for the given cell creating one if necessary.
:meth:`~wx.grid.Grid.GetRowGridLinePen`                                          Returns the pen used for horizontal grid lines.
:meth:`~wx.grid.Grid.GetRowLabelAlignment`                                       Returns the alignment used for row labels.
:meth:`~wx.grid.Grid.GetRowLabelSize`                                            Returns the current width of the row labels.
:meth:`~wx.grid.Grid.GetRowLabelValue`                                           Returns the specified row label.
:meth:`~wx.grid.Grid.GetRowMinimalAcceptableHeight`                              Returns the minimal size to which rows can be resized.
:meth:`~wx.grid.Grid.GetRowMinimalHeight`                                        Returns the minimal size for the given column.
:meth:`~wx.grid.Grid.GetRowSize`                                                 Returns the height of the specified row.
:meth:`~wx.grid.Grid.GetRowSizes`                                                Get size information for all row at once.
:meth:`~wx.grid.Grid.GetScrollLineX`                                             Returns the number of pixels per horizontal scroll increment.
:meth:`~wx.grid.Grid.GetScrollLineY`                                             Returns the number of pixels per vertical scroll increment.
:meth:`~wx.grid.Grid.GetSelectedCells`                                           Returns an array of individually selected cells.
:meth:`~wx.grid.Grid.GetSelectedCols`                                            Returns an array of selected columns.
:meth:`~wx.grid.Grid.GetSelectedRows`                                            Returns an array of selected rows.
:meth:`~wx.grid.Grid.GetSelectionBackground`                                     Returns the colour used for drawing the selection background.
:meth:`~wx.grid.Grid.GetSelectionBlockBottomRight`                               Returns an array of the bottom right corners of blocks of selected cells.
:meth:`~wx.grid.Grid.GetSelectionBlockTopLeft`                                   Returns an array of the top left corners of blocks of selected cells.
:meth:`~wx.grid.Grid.GetSelectionForeground`                                     Returns the colour used for drawing the selection foreground.
:meth:`~wx.grid.Grid.GetSelectionMode`                                           Returns the current selection mode.
:meth:`~wx.grid.Grid.GetSortingColumn`                                           Return the column in which the sorting indicator is currently displayed.
:meth:`~wx.grid.Grid.GetTable`                                                   Returns a base pointer to the current table object.
:meth:`~wx.grid.Grid.GoToCell`                                                   Make the given cell current and ensure it is visible.
:meth:`~wx.grid.Grid.GridLinesEnabled`                                           Returns ``True`` if drawing of grid lines is turned on, ``False`` otherwise.
:meth:`~wx.grid.Grid.HideCellEditControl`                                        Hides the in-place cell edit control.
:meth:`~wx.grid.Grid.HideCol`                                                    Hides the specified column.
:meth:`~wx.grid.Grid.HideColLabels`                                              Hides the column labels by calling :meth:`~Grid.SetColLabelSize`   with a size of 0.
:meth:`~wx.grid.Grid.HideRow`                                                    Hides the specified row.
:meth:`~wx.grid.Grid.HideRowLabels`                                              Hides the row labels by calling :meth:`~Grid.SetRowLabelSize`   with a size of 0.
:meth:`~wx.grid.Grid.InsertCols`                                                 Inserts one or more new columns into a grid with the first new column at the specified position.
:meth:`~wx.grid.Grid.InsertRows`                                                 Inserts one or more new rows into a grid with the first new row at the specified position.
:meth:`~wx.grid.Grid.IsCellEditControlEnabled`                                   Returns ``True`` if the in-place edit control is currently enabled.
:meth:`~wx.grid.Grid.IsCellEditControlShown`                                     Returns ``True`` if the in-place edit control is currently shown.
:meth:`~wx.grid.Grid.IsColShown`                                                 Returns ``True`` if the specified column is not currently hidden.
:meth:`~wx.grid.Grid.IsCurrentCellReadOnly`                                      Returns ``True`` if the current cell is read-only.
:meth:`~wx.grid.Grid.IsEditable`                                                 Returns ``False`` if the whole grid has been set as read-only or ``True`` otherwise.
:meth:`~wx.grid.Grid.IsInSelection`                                              Returns ``True`` if the given cell is selected.
:meth:`~wx.grid.Grid.IsReadOnly`                                                 Returns ``True`` if the cell at the specified location can't be edited.
:meth:`~wx.grid.Grid.IsRowShown`                                                 Returns ``True`` if the specified row is not currently hidden.
:meth:`~wx.grid.Grid.IsSelection`                                                Returns ``True`` if there are currently any selected cells, rows, columns or blocks.
:meth:`~wx.grid.Grid.IsSortOrderAscending`                                       Return ``True`` if the current sorting order is ascending or ``False`` if it is descending.
:meth:`~wx.grid.Grid.IsSortingBy`                                                Return ``True`` if this column is currently used for sorting.
:meth:`~wx.grid.Grid.IsVisible`                                                  Returns ``True`` if a cell is either entirely or at least partially visible in the grid window.
:meth:`~wx.grid.Grid.MakeCellVisible`                                            Brings the specified cell into the visible grid cell area with minimal scrolling.
:meth:`~wx.grid.Grid.MoveCursorDown`                                             Moves the grid cursor down by one row.
:meth:`~wx.grid.Grid.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.
:meth:`~wx.grid.Grid.MoveCursorLeft`                                             Moves the grid cursor left by one column.
:meth:`~wx.grid.Grid.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.
:meth:`~wx.grid.Grid.MoveCursorRight`                                            Moves the grid cursor right by one column.
:meth:`~wx.grid.Grid.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.
:meth:`~wx.grid.Grid.MoveCursorUp`                                               Moves the grid cursor up by one row.
:meth:`~wx.grid.Grid.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.
:meth:`~wx.grid.Grid.MovePageDown`                                               Moves the grid cursor down by some number of rows so that the previous bottom visible row becomes the top visible row.
:meth:`~wx.grid.Grid.MovePageUp`                                                 Moves the grid cursor up by some number of rows so that the previous top visible row becomes the bottom visible row.
:meth:`~wx.grid.Grid.ProcessTableMessage`                                        Receive and handle a message from the table.
:meth:`~wx.grid.Grid.RefreshAttr`                                                Invalidates the cached attribute for the given cell.
:meth:`~wx.grid.Grid.RegisterDataType`                                           Register a new data type.
:meth:`~wx.grid.Grid.Render`                                                     Draws part or all of a :ref:`wx.grid.Grid`  on a :ref:`wx.DC`  for printing or display.
:meth:`~wx.grid.Grid.ResetColPos`                                                Resets the position of the columns to the default.
:meth:`~wx.grid.Grid.SaveEditControlValue`                                       Sets the value of the current grid cell to the current in-place edit control value.
:meth:`~wx.grid.Grid.SelectAll`                                                  Selects all cells in the grid.
:meth:`~wx.grid.Grid.SelectBlock`                                                Selects a rectangular block of cells.
:meth:`~wx.grid.Grid.SelectCol`                                                  Selects the specified column.
:meth:`~wx.grid.Grid.SelectRow`                                                  Selects the specified row.
:meth:`~wx.grid.Grid.SetAttr`                                                    Sets the cell attributes for the specified cell.
:meth:`~wx.grid.Grid.SetCellAlignment`                                           Sets the horizontal and vertical alignment for grid cell text at the specified location.
:meth:`~wx.grid.Grid.SetCellBackgroundColour`                                    Set the background colour for the given cell or all cells by default.
:meth:`~wx.grid.Grid.SetCellEditor`                                              Sets the editor for the grid cell at the specified location.
:meth:`~wx.grid.Grid.SetCellFont`                                                Sets the font for text in the grid cell at the specified location.
:meth:`~wx.grid.Grid.SetCellHighlightColour`                                     
:meth:`~wx.grid.Grid.SetCellHighlightPenWidth`                                   
:meth:`~wx.grid.Grid.SetCellHighlightROPenWidth`                                 
:meth:`~wx.grid.Grid.SetCellOverflow`                                            Sets the overflow permission of the cell.
:meth:`~wx.grid.Grid.SetCellRenderer`                                            Sets the renderer for the grid cell at the specified location.
:meth:`~wx.grid.Grid.SetCellSize`                                                Set the size of the cell.
:meth:`~wx.grid.Grid.SetCellTextColour`                                          Sets the text colour for the given cell.
:meth:`~wx.grid.Grid.SetCellValue`                                               Sets the string value for the cell at the specified location.
:meth:`~wx.grid.Grid.SetColAttr`                                                 Sets the cell attributes for all cells in the specified column.
:meth:`~wx.grid.Grid.SetColFormatBool`                                           Sets the specified column to display boolean values.
:meth:`~wx.grid.Grid.SetColFormatCustom`                                         Sets the specified column to display data in a custom format.
:meth:`~wx.grid.Grid.SetColFormatFloat`                                          Sets the specified column to display floating point values with the given width and precision.
:meth:`~wx.grid.Grid.SetColFormatNumber`                                         Sets the specified column to display integer values.
:meth:`~wx.grid.Grid.SetColLabelAlignment`                                       Sets the horizontal and vertical alignment of column label text.
:meth:`~wx.grid.Grid.SetColLabelSize`                                            Sets the height of the column labels.
:meth:`~wx.grid.Grid.SetColLabelTextOrientation`                                 Sets the orientation of the column labels (either  ``HORIZONTAL``   or   ``VERTICAL`` ).
:meth:`~wx.grid.Grid.SetColLabelValue`                                           Set the value for the given column label.
:meth:`~wx.grid.Grid.SetColMinimalAcceptableWidth`                               Sets the minimal `width`  to which the user can resize columns.
:meth:`~wx.grid.Grid.SetColMinimalWidth`                                         Sets the minimal `width`  for the specified column `col`.
:meth:`~wx.grid.Grid.SetColPos`                                                  Sets the position of the specified column.
:meth:`~wx.grid.Grid.SetColSize`                                                 Sets the width of the specified column.
:meth:`~wx.grid.Grid.SetColSizes`                                                Restore all columns sizes.
:meth:`~wx.grid.Grid.SetColumnsOrder`                                            Sets the positions of all columns at once.
:meth:`~wx.grid.Grid.SetDefaultCellAlignment`                                    Sets the default horizontal and vertical alignment for grid cell text.
:meth:`~wx.grid.Grid.SetDefaultCellBackgroundColour`                             Sets the default background colour for grid cells.
:meth:`~wx.grid.Grid.SetDefaultCellFont`                                         Sets the default font to be used for grid cell text.
:meth:`~wx.grid.Grid.SetDefaultCellOverflow`                                     Sets the default overflow permission of the cells.
:meth:`~wx.grid.Grid.SetDefaultCellTextColour`                                   Sets the current default colour for grid cell text.
:meth:`~wx.grid.Grid.SetDefaultColSize`                                          Sets the default width for columns in the grid.
:meth:`~wx.grid.Grid.SetDefaultEditor`                                           Sets the default editor for grid cells.
:meth:`~wx.grid.Grid.SetDefaultRenderer`                                         Sets the default renderer for grid cells.
:meth:`~wx.grid.Grid.SetDefaultRowSize`                                          Sets the default height for rows in the grid.
:meth:`~wx.grid.Grid.SetGridCursor`                                              Set the grid cursor to the specified cell.
:meth:`~wx.grid.Grid.SetGridLineColour`                                          Sets the colour used to draw grid lines.
:meth:`~wx.grid.Grid.SetLabelBackgroundColour`                                   Sets the background colour for row and column labels.
:meth:`~wx.grid.Grid.SetLabelFont`                                               Sets the font for row and column labels.
:meth:`~wx.grid.Grid.SetLabelTextColour`                                         Sets the colour for row and column label text.
:meth:`~wx.grid.Grid.SetMargins`                                                 Sets the extra margins used around the grid area.
:meth:`~wx.grid.Grid.SetReadOnly`                                                Makes the cell at the specified location read-only or editable.
:meth:`~wx.grid.Grid.SetRowAttr`                                                 Sets the cell attributes for all cells in the specified row.
:meth:`~wx.grid.Grid.SetRowLabelAlignment`                                       Sets the horizontal and vertical alignment of row label text.
:meth:`~wx.grid.Grid.SetRowLabelSize`                                            Sets the width of the row labels.
:meth:`~wx.grid.Grid.SetRowLabelValue`                                           Sets the value for the given row label.
:meth:`~wx.grid.Grid.SetRowMinimalAcceptableHeight`                              Sets the minimal row `height`  used by default.
:meth:`~wx.grid.Grid.SetRowMinimalHeight`                                        Sets the minimal `height`  for the specified `row`.
:meth:`~wx.grid.Grid.SetRowSize`                                                 Sets the height of the specified row.
:meth:`~wx.grid.Grid.SetRowSizes`                                                Restore all rows sizes.
:meth:`~wx.grid.Grid.SetScrollLineX`                                             Sets the number of pixels per horizontal scroll increment.
:meth:`~wx.grid.Grid.SetScrollLineY`                                             Sets the number of pixels per vertical scroll increment.
:meth:`~wx.grid.Grid.SetSelectionBackground`                                     Set the colour to be used for drawing the selection background.
:meth:`~wx.grid.Grid.SetSelectionForeground`                                     Set the colour to be used for drawing the selection foreground.
:meth:`~wx.grid.Grid.SetSelectionMode`                                           Set the selection behaviour of the grid.
:meth:`~wx.grid.Grid.SetSortingColumn`                                           Set the column to display the sorting indicator in and its direction.
:meth:`~wx.grid.Grid.SetTabBehaviour`                                            Set the grid's behaviour when the user presses the ``TAB`` key.
:meth:`~wx.grid.Grid._SetTable`                                                  Passes a pointer to a custom grid table to be used by the grid.
:meth:`~wx.grid.Grid.SetTable`                                                   Set the Grid Table to be used by this grid.
:meth:`~wx.grid.Grid.SetUseNativeColLabels`                                      Call this in order to make the column labels use a native look by using :meth:`wx.RendererNative.DrawHeaderButton`   internally.
:meth:`~wx.grid.Grid.ShowCellEditControl`                                        Displays the in-place cell edit control for the current cell.
:meth:`~wx.grid.Grid.ShowCol`                                                    Shows the previously hidden column by resizing it to non-0 size.
:meth:`~wx.grid.Grid.ShowRow`                                                    Shows the previously hidden row.
:meth:`~wx.grid.Grid.UnsetSortingColumn`                                         Remove any currently shown sorting indicator.
:meth:`~wx.grid.Grid.UseNativeColHeader`                                         Enable the use of native header window for column labels.
:meth:`~wx.grid.Grid.XToCol`                                                     Returns the column at the given pixel position.
:meth:`~wx.grid.Grid.XToEdgeOfCol`                                               Returns the column whose right hand edge is close to the given logical `x`  position.
:meth:`~wx.grid.Grid.XYToCell`                                                   Translates logical pixel coordinates to the grid cell coordinates.
:meth:`~wx.grid.Grid.YToEdgeOfRow`                                               Returns the row whose bottom edge is close to the given logical `y`  position.
:meth:`~wx.grid.Grid.YToRow`                                                     Returns the grid row that corresponds to the logical `y`  coordinate.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.grid.Grid.BatchCount`                                                 See :meth:`~wx.grid.Grid.GetBatchCount`
:attr:`~wx.grid.Grid.CellHighlightColour`                                        See :meth:`~wx.grid.Grid.GetCellHighlightColour` and :meth:`~wx.grid.Grid.SetCellHighlightColour`
:attr:`~wx.grid.Grid.CellHighlightPenWidth`                                      See :meth:`~wx.grid.Grid.GetCellHighlightPenWidth` and :meth:`~wx.grid.Grid.SetCellHighlightPenWidth`
:attr:`~wx.grid.Grid.CellHighlightROPenWidth`                                    See :meth:`~wx.grid.Grid.GetCellHighlightROPenWidth` and :meth:`~wx.grid.Grid.SetCellHighlightROPenWidth`
:attr:`~wx.grid.Grid.ColLabelSize`                                               See :meth:`~wx.grid.Grid.GetColLabelSize` and :meth:`~wx.grid.Grid.SetColLabelSize`
:attr:`~wx.grid.Grid.ColLabelTextOrientation`                                    See :meth:`~wx.grid.Grid.GetColLabelTextOrientation` and :meth:`~wx.grid.Grid.SetColLabelTextOrientation`
:attr:`~wx.grid.Grid.ColMinimalAcceptableWidth`                                  See :meth:`~wx.grid.Grid.GetColMinimalAcceptableWidth` and :meth:`~wx.grid.Grid.SetColMinimalAcceptableWidth`
:attr:`~wx.grid.Grid.ColSizes`                                                   See :meth:`~wx.grid.Grid.GetColSizes` and :meth:`~wx.grid.Grid.SetColSizes`
:attr:`~wx.grid.Grid.DefaultCellBackgroundColour`                                See :meth:`~wx.grid.Grid.GetDefaultCellBackgroundColour` and :meth:`~wx.grid.Grid.SetDefaultCellBackgroundColour`
:attr:`~wx.grid.Grid.DefaultCellFont`                                            See :meth:`~wx.grid.Grid.GetDefaultCellFont` and :meth:`~wx.grid.Grid.SetDefaultCellFont`
:attr:`~wx.grid.Grid.DefaultCellOverflow`                                        See :meth:`~wx.grid.Grid.GetDefaultCellOverflow` and :meth:`~wx.grid.Grid.SetDefaultCellOverflow`
:attr:`~wx.grid.Grid.DefaultCellTextColour`                                      See :meth:`~wx.grid.Grid.GetDefaultCellTextColour` and :meth:`~wx.grid.Grid.SetDefaultCellTextColour`
:attr:`~wx.grid.Grid.DefaultColLabelSize`                                        See :meth:`~wx.grid.Grid.GetDefaultColLabelSize`
:attr:`~wx.grid.Grid.DefaultColSize`                                             See :meth:`~wx.grid.Grid.GetDefaultColSize` and :meth:`~wx.grid.Grid.SetDefaultColSize`
:attr:`~wx.grid.Grid.DefaultEditor`                                              See :meth:`~wx.grid.Grid.GetDefaultEditor` and :meth:`~wx.grid.Grid.SetDefaultEditor`
:attr:`~wx.grid.Grid.DefaultGridLinePen`                                         See :meth:`~wx.grid.Grid.GetDefaultGridLinePen`
:attr:`~wx.grid.Grid.DefaultRenderer`                                            See :meth:`~wx.grid.Grid.GetDefaultRenderer` and :meth:`~wx.grid.Grid.SetDefaultRenderer`
:attr:`~wx.grid.Grid.DefaultRowLabelSize`                                        See :meth:`~wx.grid.Grid.GetDefaultRowLabelSize`
:attr:`~wx.grid.Grid.DefaultRowSize`                                             See :meth:`~wx.grid.Grid.GetDefaultRowSize` and :meth:`~wx.grid.Grid.SetDefaultRowSize`
:attr:`~wx.grid.Grid.GridColHeader`                                              See :meth:`~wx.grid.Grid.GetGridColHeader`
:attr:`~wx.grid.Grid.GridColLabelWindow`                                         See :meth:`~wx.grid.Grid.GetGridColLabelWindow`
:attr:`~wx.grid.Grid.GridCornerLabelWindow`                                      See :meth:`~wx.grid.Grid.GetGridCornerLabelWindow`
:attr:`~wx.grid.Grid.GridCursorCol`                                              See :meth:`~wx.grid.Grid.GetGridCursorCol`
:attr:`~wx.grid.Grid.GridCursorRow`                                              See :meth:`~wx.grid.Grid.GetGridCursorRow`
:attr:`~wx.grid.Grid.GridLineColour`                                             See :meth:`~wx.grid.Grid.GetGridLineColour` and :meth:`~wx.grid.Grid.SetGridLineColour`
:attr:`~wx.grid.Grid.GridRowLabelWindow`                                         See :meth:`~wx.grid.Grid.GetGridRowLabelWindow`
:attr:`~wx.grid.Grid.GridWindow`                                                 See :meth:`~wx.grid.Grid.GetGridWindow`
:attr:`~wx.grid.Grid.LabelBackgroundColour`                                      See :meth:`~wx.grid.Grid.GetLabelBackgroundColour` and :meth:`~wx.grid.Grid.SetLabelBackgroundColour`
:attr:`~wx.grid.Grid.LabelFont`                                                  See :meth:`~wx.grid.Grid.GetLabelFont` and :meth:`~wx.grid.Grid.SetLabelFont`
:attr:`~wx.grid.Grid.LabelTextColour`                                            See :meth:`~wx.grid.Grid.GetLabelTextColour` and :meth:`~wx.grid.Grid.SetLabelTextColour`
:attr:`~wx.grid.Grid.NumberCols`                                                 See :meth:`~wx.grid.Grid.GetNumberCols`
:attr:`~wx.grid.Grid.NumberRows`                                                 See :meth:`~wx.grid.Grid.GetNumberRows`
:attr:`~wx.grid.Grid.RowLabelSize`                                               See :meth:`~wx.grid.Grid.GetRowLabelSize` and :meth:`~wx.grid.Grid.SetRowLabelSize`
:attr:`~wx.grid.Grid.RowMinimalAcceptableHeight`                                 See :meth:`~wx.grid.Grid.GetRowMinimalAcceptableHeight` and :meth:`~wx.grid.Grid.SetRowMinimalAcceptableHeight`
:attr:`~wx.grid.Grid.RowSizes`                                                   See :meth:`~wx.grid.Grid.GetRowSizes` and :meth:`~wx.grid.Grid.SetRowSizes`
:attr:`~wx.grid.Grid.ScrollLineX`                                                See :meth:`~wx.grid.Grid.GetScrollLineX` and :meth:`~wx.grid.Grid.SetScrollLineX`
:attr:`~wx.grid.Grid.ScrollLineY`                                                See :meth:`~wx.grid.Grid.GetScrollLineY` and :meth:`~wx.grid.Grid.SetScrollLineY`
:attr:`~wx.grid.Grid.SelectedCells`                                              See :meth:`~wx.grid.Grid.GetSelectedCells`
:attr:`~wx.grid.Grid.SelectedCols`                                               See :meth:`~wx.grid.Grid.GetSelectedCols`
:attr:`~wx.grid.Grid.SelectedRows`                                               See :meth:`~wx.grid.Grid.GetSelectedRows`
:attr:`~wx.grid.Grid.SelectionBackground`                                        See :meth:`~wx.grid.Grid.GetSelectionBackground` and :meth:`~wx.grid.Grid.SetSelectionBackground`
:attr:`~wx.grid.Grid.SelectionBlockBottomRight`                                  See :meth:`~wx.grid.Grid.GetSelectionBlockBottomRight`
:attr:`~wx.grid.Grid.SelectionBlockTopLeft`                                      See :meth:`~wx.grid.Grid.GetSelectionBlockTopLeft`
:attr:`~wx.grid.Grid.SelectionForeground`                                        See :meth:`~wx.grid.Grid.GetSelectionForeground` and :meth:`~wx.grid.Grid.SetSelectionForeground`
:attr:`~wx.grid.Grid.SelectionMode`                                              See :meth:`~wx.grid.Grid.GetSelectionMode` and :meth:`~wx.grid.Grid.SetSelectionMode`
:attr:`~wx.grid.Grid.SortingColumn`                                              See :meth:`~wx.grid.Grid.GetSortingColumn` and :meth:`~wx.grid.Grid.SetSortingColumn`
:attr:`~wx.grid.Grid.Table`                                                      See :meth:`~wx.grid.Grid.GetTable` and :meth:`~wx.grid.Grid.SetTable`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.grid.Grid(ScrolledWindow)

   **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.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                  
      
      You must call :meth:`Create`   to really create the grid window and also call :meth:`CreateGrid`   or :meth:`SetTable`   to initialize the grid 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 :meth:`CreateGrid`   or :meth:`SetTable`   to initialize the grid contents before using it.                  
      
      
      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `name`: 
      :type `name`: string
      
      
      
      
      
      
      **~~~**






   .. method:: 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 :meth:`wx.grid.GridTableBase.AppendCols` . See :meth:`InsertCols`   for further information. 

                


      :param `numCols`: 
      :type `numCols`: int
      :param `updateLabels`: 
      :type `updateLabels`: bool




      :rtype: `bool`







      :returns: 

         ``True`` on success or ``False`` if appending columns failed.   








   .. method:: 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 :meth:`wx.grid.GridTableBase.AppendRows` . See :meth:`InsertRows`   for further information. 

                


      :param `numRows`: 
      :type `numRows`: int
      :param `updateLabels`: 
      :type `updateLabels`: bool




      :rtype: `bool`







      :returns: 

         ``True`` on success or ``False`` if appending rows failed.   








   .. method:: 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. 

                

      :rtype: `bool`







      .. seealso:: :meth:`ClipHorzGridLines` , :meth:`AreVertGridLinesClipped`     








   .. method:: 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. 

                

      :rtype: `bool`







      .. seealso:: :meth:`ClipVertGridLines` , :meth:`AreHorzGridLinesClipped`     








   .. method:: AutoSize(self)

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





   .. method:: AutoSizeColLabelSize(self, col)

      Automatically adjusts width of the column to fit its label.                  


      :param `col`: 
      :type `col`: int







   .. method:: 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.                  


      :param `col`: 
      :type `col`: int
      :param `setAsMin`: 
      :type `setAsMin`: bool







   .. method:: 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.                  


      :param `setAsMin`: 
      :type `setAsMin`: bool







   .. method:: 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.                  


      :param `row`: 
      :type `row`: int
      :param `setAsMin`: 
      :type `setAsMin`: bool







   .. method:: AutoSizeRowLabelSize(self, col)

      Automatically adjusts height of the row to fit its label.                  


      :param `col`: 
      :type `col`: int







   .. method:: 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.                  


      :param `setAsMin`: 
      :type `setAsMin`: bool







   .. method:: 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 :meth:`EndBatch` . Code that does a lot of grid modification can be enclosed between :meth:`BeginBatch`   and :meth:`EndBatch`   calls to avoid screen flicker. The final :meth:`EndBatch`   call will cause the grid to be repainted. 

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





   .. method:: BlockToDeviceRect(self, topLeft, bottomRight)

      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. 

                


      :param `topLeft`: 
      :type `topLeft`: wx.grid.GridCellCoords
      :param `bottomRight`: 
      :type `bottomRight`: wx.grid.GridCellCoords




      :rtype: :ref:`Rect`







      .. seealso:: :meth:`CellToRect`     








   .. method:: CalcCellsExposed(self, reg)

      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 :meth:`wx.grid.GridTableBase.AppendCols` . See :meth:`InsertCols`   for further information. 

                


      :param `reg`: 
      :type `reg`: wx.Region




      :rtype: :ref:`GridCellCoordsArray`







      :returns: 

         ``True`` on success or ``False`` if appending columns failed.   








   .. method:: CalcColLabelsExposed(self, reg)

      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 :meth:`wx.grid.GridTableBase.AppendCols` . See :meth:`InsertCols`   for further information. 

                


      :param `reg`: 
      :type `reg`: wx.Region




      :rtype: `list of integers`







      :returns: 

         ``True`` on success or ``False`` if appending columns failed.   








   .. method:: CalcRowLabelsExposed(self, reg)

      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 :meth:`wx.grid.GridTableBase.AppendCols` . See :meth:`InsertCols`   for further information. 

                


      :param `reg`: 
      :type `reg`: wx.Region




      :rtype: `list of integers`







      :returns: 

         ``True`` on success or ``False`` if appending columns failed.   








   .. method:: CanDragCell(self)

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

      :rtype: `bool`








   .. method:: CanDragColMove(self)

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

      Columns can be moved by dragging on their labels.                  

      :rtype: `bool`








   .. method:: 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 :meth:`DisableDragColSize`   hadn't been called, and if this column wasn't explicitly marked as non-resizable with :meth:`DisableColResize` .                  


      :param `col`: 
      :type `col`: int




      :rtype: `bool`








   .. method:: CanDragGridSize(self)

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

      :rtype: `bool`








   .. method:: CanDragRowSize(self, row)

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

      This is the same as :meth:`CanDragColSize`   but for rows.                  


      :param `row`: 
      :type `row`: int




      :rtype: `bool`








   .. method:: 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.                  

      :rtype: `bool`








   .. method:: 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. :meth:`wx.grid.GridTableBase.CanHaveAttributes`   returns ``True``.                  

      :rtype: `bool`








   .. method:: CellToRect(self, *args, **kw)

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

                 



      .. seealso:: :meth:`BlockToDeviceRect`     





      |overload| Overloaded Implementations:

      **~~~**

      
      **CellToRect** `(self, row, col)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      :rtype: :ref:`Rect`
      
      
      
      
      
      
      
      **~~~**

      
      **CellToRect** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      :rtype: :ref:`Rect`
      
      
      
      
      
      
      
      **~~~**






   .. method:: 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 :meth:`wx.grid.GridTableBase.Clear`   for this function to have any effect.                   





   .. method:: ClearSelection(self)

      Deselects all cells that are currently selected.                   





   .. method:: 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. 

                


      :param `clip`: 
      :type `clip`: bool






      .. seealso:: :meth:`AreHorzGridLinesClipped` , :meth:`ClipVertGridLines`     








   .. method:: 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. 

                


      :param `clip`: 
      :type `clip`: bool






      .. seealso:: :meth:`AreVertGridLinesClipped` , :meth:`ClipHorzGridLines`     








   .. method:: 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 :meth:`CreateGrid`   or :meth:`SetTable`   to initialize the grid contents before using it.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `name`: 
      :type `name`: string




      :rtype: `bool`








   .. method:: 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 :ref:`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 :meth:`SetTable` .                  


      :param `numRows`: 
      :type `numRows`: int
      :param `numCols`: 
      :type `numCols`: int
      :param `selmode`: 
      :type `selmode`: wx.grid.Grid.GridSelectionModes




      :rtype: `bool`








   .. method:: 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 :meth:`wx.grid.GridTableBase.DeleteCols` . See :meth:`InsertCols`   for further information. 

                


      :param `pos`: 
      :type `pos`: int
      :param `numCols`: 
      :type `numCols`: int
      :param `updateLabels`: 
      :type `updateLabels`: bool




      :rtype: `bool`







      :returns: 

         ``True`` on success or ``False`` if deleting columns failed.   








   .. method:: 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 :meth:`wx.grid.GridTableBase.DeleteRows` . See :meth:`InsertRows`   for further information. 

                


      :param `pos`: 
      :type `pos`: int
      :param `numRows`: 
      :type `numRows`: int
      :param `updateLabels`: 
      :type `updateLabels`: bool




      :rtype: `bool`







      :returns: 

         ``True`` on success or ``False`` if appending rows failed.   








   .. method:: DeselectCell(self, row, col)

      Deselects a cell.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int







   .. method:: DeselectCol(self, col)

      Deselects a column of cells.                  


      :param `col`: 
      :type `col`: int







   .. method:: DeselectRow(self, row)

      Deselects a row of cells.                  


      :param `row`: 
      :type `row`: int







   .. method:: DisableCellEditControl(self)

      Disables in-place editing of grid cells.                  

      Equivalent to calling EnableCellEditControl(false).                   





   .. method:: DisableColResize(self, col)

      Disable interactive resizing of the specified column.                  

      This method allows 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. 

                


      :param `col`: 
      :type `col`: int






      .. seealso:: :meth:`EnableDragColSize`     








   .. method:: DisableDragColMove(self)

      Disables column moving by dragging with the mouse.                  

      Equivalent to passing ``False`` to :meth:`EnableDragColMove` .                   





   .. method:: DisableDragColSize(self)

      Disables column sizing by dragging with the mouse.                  

      Equivalent to passing ``False`` to :meth:`EnableDragColSize` .                   





   .. method:: DisableDragGridSize(self)

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

      Equivalent to passing ``False`` to :meth:`EnableDragGridSize`                     





   .. method:: DisableDragRowSize(self)

      Disables row sizing by dragging with the mouse.                  

      Equivalent to passing ``False`` to :meth:`EnableDragRowSize` .                   





   .. method:: DisableRowResize(self, row)

      Disable interactive resizing of the specified row.                  

      This is the same as :meth:`DisableColResize`   but for rows. 

                


      :param `row`: 
      :type `row`: int






      .. seealso:: :meth:`EnableDragRowSize`     








   .. method:: DrawCellHighlight(self, dc, attr)




      :param `dc`: 
      :type `dc`: wx.DC
      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr







   .. method:: DrawColLabel(self, dc, col)




      :param `dc`: 
      :type `dc`: wx.DC
      :param `col`: 
      :type `col`: int







   .. method:: DrawColLabels(self, dc, cols)




      :param `dc`: 
      :type `dc`: wx.DC
      :param `cols`: 
      :type `cols`: list of integers







   .. method:: DrawCornerLabel(self, dc)




      :param `dc`: 
      :type `dc`: wx.DC







   .. method:: DrawRowLabel(self, dc, row)




      :param `dc`: 
      :type `dc`: wx.DC
      :param `row`: 
      :type `row`: int







   .. method:: DrawRowLabels(self, dc, rows)




      :param `dc`: 
      :type `dc`: wx.DC
      :param `rows`: 
      :type `rows`: list of integers







   .. method:: DrawTextRectangle(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **DrawTextRectangle** `(self, dc, text, rect, horizontalAlignment=ALIGN_LEFT, verticalAlignment=ALIGN_TOP, textOrientation=HORIZONTAL)`
      
      
      
      
      :param `dc`: 
      :type `dc`: wx.DC
      :param `text`: 
      :type `text`: string
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `horizontalAlignment`: 
      :type `horizontalAlignment`: int
      :param `verticalAlignment`: 
      :type `verticalAlignment`: int
      :param `textOrientation`: 
      :type `textOrientation`: int
      
      
      
      
      
      
      **~~~**

      
      **DrawTextRectangle** `(self, dc, lines, rect, horizontalAlignment=ALIGN_LEFT, verticalAlignment=ALIGN_TOP, textOrientation=HORIZONTAL)`
      
      
      
      
      :param `dc`: 
      :type `dc`: wx.DC
      :param `lines`: 
      :type `lines`: list of strings
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `horizontalAlignment`: 
      :type `horizontalAlignment`: int
      :param `verticalAlignment`: 
      :type `verticalAlignment`: int
      :param `textOrientation`: 
      :type `textOrientation`: int
      
      
      
      
      
      
      **~~~**






   .. method:: EnableCellEditControl(self, enable=True)

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

      The grid will issue either a  ``wxEVT_GRID_EDITOR_SHOWN``   or   ``wxEVT_GRID_EDITOR_HIDDEN``   event.                   


      :param `enable`: 
      :type `enable`: bool







   .. method:: EnableDragCell(self, enable=True)

      Enables or disables cell dragging with the mouse.                  


      :param `enable`: 
      :type `enable`: bool







   .. method:: EnableDragColMove(self, enable=True)

      Enables or disables column moving by dragging with the mouse.                  


      :param `enable`: 
      :type `enable`: bool







   .. method:: EnableDragColSize(self, enable=True)

      Enables or disables column sizing by dragging with the mouse.                  

                


      :param `enable`: 
      :type `enable`: bool






      .. seealso:: :meth:`DisableColResize`     








   .. method:: EnableDragGridSize(self, enable=True)

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


      :param `enable`: 
      :type `enable`: bool







   .. method:: EnableDragRowSize(self, enable=True)

      Enables or disables row sizing by dragging with the mouse.                  

                


      :param `enable`: 
      :type `enable`: bool






      .. seealso:: :meth:`DisableRowResize`     








   .. method:: 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 :meth:`wx.grid.GridCellAttr.SetReadOnly` . For single cells you can also use the shortcut function :meth:`SetReadOnly` . 

      For more information about controlling grid cell attributes see the :ref:`wx.grid.GridCellAttr`  class and the :ref:`Grid Overview <grid overview>`.                  


      :param `edit`: 
      :type `edit`: bool







   .. method:: EnableGridLines(self, enable=True)

      Turns the drawing of grid lines on or off.                  


      :param `enable`: 
      :type `enable`: bool







   .. method:: 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 :meth:`BeginBatch`   must be matched by a later call to :meth:`EndBatch` . Code that does a lot of grid modification can be enclosed between :meth:`BeginBatch`   and :meth:`EndBatch`   calls to avoid screen flicker. The final :meth:`EndBatch`   will cause the grid to be repainted. 

                 



      .. seealso:: :ref:`wx.grid.GridUpdateLocker`    








   .. method:: Fit(self)

      Overridden :ref:`wx.Window`  method.                   





   .. method:: ForceRefresh(self)

      Causes immediate repainting of the grid.                  

      Use this instead of the usual :meth:`wx.Window.Refresh` .                   





   .. method:: GetBatchCount(self)

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

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

      :rtype: `int`








   .. method:: 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`` .                   


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: `tuple`







      :returns: 

         ( `horiz`, `vert` ) 








   .. method:: GetCellBackgroundColour(self, row, col)

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`Colour`








   .. method:: GetCellEditor(self, row, col)

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

      See :ref:`wx.grid.GridCellEditor`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers. 

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`wx.grid.GridCellEditor`








   .. method:: GetCellFont(self, row, col)

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`Font`








   .. method:: GetCellHighlightColour(self)



      :rtype: :ref:`Colour`








   .. method:: GetCellHighlightPenWidth(self)



      :rtype: `int`








   .. method:: GetCellHighlightROPenWidth(self)



      :rtype: `int`








   .. method:: GetCellOverflow(self, row, col)

      Returns ``True`` if the cell value can overflow.                  

      A cell can overflow if the next cell in the row is empty.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: `bool`








   .. method:: GetCellRenderer(self, row, col)

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

      See :ref:`wx.grid.GridCellRenderer`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers. 

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`wx.grid.GridCellRenderer`








   .. method:: 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 :meth:`SetCellSize`   had been called, the returned values are the same ones as were passed to :meth:`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 
      
      .. code-block:: text
      
          +----+----+----+
          |    |    |    |
          +----+----+----+
          |    |         |
          +----+         |
          |    |         |
          +----+----+----+
      
      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). 
      
      
      
      
      :param `row`: The row of the cell.   
      :type `row`: int
      :param `col`: The column of the cell.   
      :type `col`: int
      :param `num_rows`: Pointer to variable receiving the number of rows, must not be ``None``.   
      :type `num_rows`: int
      :param `num_cols`: Pointer to variable receiving the number of columns, must not be ``None``.   
      :type `num_cols`: int
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`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.                  
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      :rtype: :ref:`Size`
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetCellTextColour(self, row, col)

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`Colour`








   .. method:: 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 :meth:`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 :meth:`wx.grid.GridTableBase.CanGetValueAs`   and the :ref:`Grid Overview <grid overview>`  for more information.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **GetCellValue** `(self, row, col)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      :rtype: `string`
      
      
      
      
      
      
      
      **~~~**

      
      **GetCellValue** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      :rtype: `string`
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetColAt(self, colPos)

      Returns the column ``ID`` of the specified column position.                  


      :param `colPos`: 
      :type `colPos`: int




      :rtype: `int`








   .. method:: 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 :meth:`GetRowGridLinePen`   for an example.                  


      :param `col`: 
      :type `col`: int




      :rtype: :ref:`Pen`








   .. method:: 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`` .                   

      :rtype: `tuple`







      :returns: 

         ( `horiz`, `vert` ) 








   .. method:: GetColLabelSize(self)

      Returns the current height of the column labels.                  

      :rtype: `int`








   .. method:: GetColLabelTextOrientation(self)

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

      :rtype: `int`








   .. method:: 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 :meth:`wx.grid.GridTableBase.GetColLabelValue`   to provide your own labels.                  


      :param `col`: 
      :type `col`: int




      :rtype: `string`








   .. method:: GetColLeft(self, col)

      Returns the coordinate of the left border specified column.                  


      :param `col`: 
      :type `col`: int




      :rtype: `int`








   .. method:: GetColMinimalAcceptableWidth(self)

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

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

                

      :rtype: `int`







      .. seealso:: :meth:`GetRowMinimalAcceptableHeight`     








   .. method:: GetColMinimalWidth(self, col)

      Get the minimal width of the given column/row.                  

      The value returned by this function may be different than that returned by :meth:`GetColMinimalAcceptableWidth`   if :meth:`SetColMinimalWidth`   had been called for this column.                  


      :param `col`: 
      :type `col`: int




      :rtype: `int`








   .. method:: GetColPos(self, colID)

      Returns the position of the specified column.                  


      :param `colID`: 
      :type `colID`: int




      :rtype: `int`








   .. method:: GetColRight(self, col)

      Returns the coordinate of the right border specified column.                  


      :param `col`: 
      :type `col`: int




      :rtype: `int`








   .. method:: GetColSize(self, col)

      Returns the width of the specified column.                  


      :param `col`: 
      :type `col`: int




      :rtype: `int`








   .. method:: 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 :meth:`SetColSizes` . 

                

      :rtype: :ref:`wx.grid.GridSizesInfo`







      .. seealso:: :ref:`wx.grid.GridSizesInfo`, :meth:`GetRowSizes`     








   .. method:: 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`` . 

                

      :rtype: `tuple`







      :returns: 

         ( `horiz`, `vert` ) 







      .. seealso:: :meth:`SetDefaultCellAlignment`     








   .. method:: GetDefaultCellBackgroundColour(self)

      Returns the current default background colour for grid cells.                  

      :rtype: :ref:`Colour`








   .. method:: GetDefaultCellFont(self)

      Returns the current default font for grid cell text.                  

      :rtype: :ref:`Font`








   .. method:: GetDefaultCellOverflow(self)

      Returns ``True`` if the cells can overflow by default.                  

      :rtype: `bool`








   .. method:: GetDefaultCellTextColour(self)

      Returns the current default colour for grid cell text.                  

      :rtype: :ref:`Colour`








   .. method:: GetDefaultColLabelSize(self)

      Returns the default height for column labels.                  

      :rtype: `int`








   .. method:: GetDefaultColSize(self)

      Returns the current default width for grid columns.                  

      :rtype: `int`








   .. method:: GetDefaultEditor(self)

      Returns a pointer to the current default grid cell editor.                  

      See :ref:`wx.grid.GridCellEditor`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers.                  

      :rtype: :ref:`wx.grid.GridCellEditor`








   .. method:: 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)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      :rtype: :ref:`wx.grid.GridCellEditor`
      
      
      
      
      
      
      
      **~~~**

      
      **GetDefaultEditorForCell** `(self, c)`
      
      
      
      
      :param `c`: 
      :type `c`: wx.grid.GridCellCoords
      
      
      
      
      :rtype: :ref:`wx.grid.GridCellEditor`
      
      
      
      
      
      
      
      **~~~**






   .. method:: 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 :meth:`RegisterDataType`   but this function may be overridden to return something different. This allows to override an editor used for one of the standard types. 

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


      :param `typeName`: 
      :type `typeName`: string




      :rtype: :ref:`wx.grid.GridCellEditor`








   .. method:: 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. 

                

      :rtype: :ref:`Pen`







      .. seealso:: :meth:`GetColGridLinePen` , :meth:`GetRowGridLinePen`     








   .. method:: GetDefaultRenderer(self)

      Returns a pointer to the current default grid cell renderer.                  

      See :ref:`wx.grid.GridCellRenderer`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers. 

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

      :rtype: :ref:`wx.grid.GridCellRenderer`








   .. method:: 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.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`wx.grid.GridCellRenderer`








   .. method:: GetDefaultRendererForType(self, typeName)

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

                


      :param `typeName`: 
      :type `typeName`: string




      :rtype: :ref:`wx.grid.GridCellRenderer`







      .. seealso:: :meth:`GetDefaultEditorForType`     








   .. method:: GetDefaultRowLabelSize(self)

      Returns the default width for the row labels.                  

      :rtype: `int`








   .. method:: GetDefaultRowSize(self)

      Returns the current default height for grid rows.                  

      :rtype: `int`








   .. method:: GetGridColHeader(self)

      Return the header control used for column labels display.                  

      This function can only be called if :meth:`UseNativeColHeader`   had been called.                  

      :rtype: :ref:`HeaderCtrl`








   .. method:: GetGridColLabelWindow(self)

      Return the column labels window.                  

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

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

      :rtype: :ref:`Window`








   .. method:: 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 :ref:`wx.grid.Grid`  however and can be used to select the entire grid.                  

      :rtype: :ref:`Window`








   .. method:: GetGridCursorCol(self)

      Returns the current grid cell column position.                  

      :rtype: `int`








   .. method:: GetGridCursorRow(self)

      Returns the current grid cell row position.                  

      :rtype: `int`








   .. method:: GetGridLineColour(self)

      Returns the colour used for grid lines.                  

                

      :rtype: :ref:`Colour`







      .. seealso:: :meth:`GetDefaultGridLinePen`     








   .. method:: GetGridRowLabelWindow(self)

      Return the row labels window.                  

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

      :rtype: :ref:`Window`








   .. method:: GetGridWindow(self)

      Return the main grid window containing the grid cells.                  

      This window is always shown.                  

      :rtype: :ref:`Window`








   .. method:: GetLabelBackgroundColour(self)

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

      :rtype: :ref:`Colour`








   .. method:: GetLabelFont(self)

      Returns the font used for row and column labels.                  

      :rtype: :ref:`Font`








   .. method:: GetLabelTextColour(self)

      Returns the colour used for row and column label text.                  

      :rtype: :ref:`Colour`








   .. method:: GetNumberCols(self)

      Returns the total number of grid columns.                  

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

      :rtype: `int`








   .. method:: GetNumberRows(self)

      Returns the total number of grid rows.                  

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

      :rtype: `int`








   .. method:: 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. 

      This function may only be called if :meth:`CanHaveAttributes`   returns ``True``.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: :ref:`wx.grid.GridCellAttr`








   .. method:: 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()

                 


      :param `row`: 
      :type `row`: int




      :rtype: :ref:`Pen`








   .. method:: 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`` .                   

      :rtype: `tuple`







      :returns: 

         ( `horiz`, `vert` ) 








   .. method:: GetRowLabelSize(self)

      Returns the current width of the row labels.                  

      :rtype: `int`








   .. method:: 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 :meth:`wx.grid.GridTableBase.GetRowLabelValue`   to provide your own labels.                  


      :param `row`: 
      :type `row`: int




      :rtype: `string`








   .. method:: GetRowMinimalAcceptableHeight(self)

      Returns the minimal size to which rows can be resized.                  

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

                

      :rtype: `int`







      .. seealso:: :meth:`GetColMinimalAcceptableWidth`     








   .. method:: GetRowMinimalHeight(self, col)

      Returns the minimal size for the given column.                  

      The value returned by this function may be different than that returned by :meth:`GetRowMinimalAcceptableHeight`   if :meth:`SetRowMinimalHeight`   had been called for this row.                  


      :param `col`: 
      :type `col`: int




      :rtype: `int`








   .. method:: GetRowSize(self, row)

      Returns the height of the specified row.                  


      :param `row`: 
      :type `row`: int




      :rtype: `int`








   .. method:: GetRowSizes(self)

      Get size information for all row at once.                  

                

      :rtype: :ref:`wx.grid.GridSizesInfo`







      .. seealso:: :ref:`wx.grid.GridSizesInfo`, :meth:`GetColSizes`     








   .. method:: GetScrollLineX(self)

      Returns the number of pixels per horizontal scroll increment.                  

      The default is 15. 

                

      :rtype: `int`







      .. seealso:: :meth:`GetScrollLineY` , :meth:`SetScrollLineX` , :meth:`SetScrollLineY`     








   .. method:: GetScrollLineY(self)

      Returns the number of pixels per vertical scroll increment.                  

      The default is 15. 

                

      :rtype: `int`







      .. seealso:: :meth:`GetScrollLineX` , :meth:`SetScrollLineX` , :meth:`SetScrollLineY`     








   .. method:: 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, :meth:`GetSelectedCols` , :meth:`GetSelectedRows`   and :meth:`GetSelectionBlockTopLeft`   and :meth:`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 :meth:`GetSelectedCols`   returns an array containing one element).                  

      :rtype: :ref:`GridCellCoordsArray`








   .. method:: 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 :meth:`GetSelectedCells`   for more details.                  

      :rtype: `list of integers`








   .. method:: 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 :meth:`GetSelectedCells`   for more details.                  

      :rtype: `list of integers`








   .. method:: GetSelectionBackground(self)

      Returns the colour used for drawing the selection background.                  

      :rtype: :ref:`Colour`








   .. method:: GetSelectionBlockBottomRight(self)

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

      Please see :meth:`GetSelectedCells`   for more information about the selection representation in :ref:`wx.grid.Grid`. 

                

      :rtype: :ref:`GridCellCoordsArray`







      .. seealso:: :meth:`GetSelectionBlockTopLeft`     








   .. method:: GetSelectionBlockTopLeft(self)

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

      Please see :meth:`GetSelectedCells`   for more information about the selection representation in :ref:`wx.grid.Grid`. 

                

      :rtype: :ref:`GridCellCoordsArray`







      .. seealso:: :meth:`GetSelectionBlockBottomRight`     








   .. method:: GetSelectionForeground(self)

      Returns the colour used for drawing the selection foreground.                  

      :rtype: :ref:`Colour`








   .. method:: GetSelectionMode(self)

      Returns the current selection mode.                  

                

      :rtype: :ref:`wx.grid.Grid.GridSelectionModes`







      .. seealso:: :meth:`SetSelectionMode` .   








   .. method:: 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. 

                

      :rtype: `int`







      .. seealso:: :meth:`SetSortingColumn`     








   .. method:: GetTable(self)

      Returns a base pointer to the current table object.                  

      The returned pointer is still owned by the grid.                  

      :rtype: :ref:`wx.grid.GridTableBase`








   .. method:: GoToCell(self, *args, **kw)

      Make the given cell current and ensure it is visible.                  

      This method is equivalent to calling :meth:`MakeCellVisible`   and :meth:`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)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      
      
      **~~~**

      
      **GoToCell** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      
      
      **~~~**






   .. method:: GridLinesEnabled(self)

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

      :rtype: `bool`








   .. method:: HideCellEditControl(self)

      Hides the in-place cell edit control.                   





   .. method:: HideCol(self, col)

      Hides the specified column.                  

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

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




      :param `col`: The column index.   
      :type `col`: int




                  





   .. method:: HideColLabels(self)

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

      Show labels again by calling that method with a width greater than 0.                   





   .. method:: HideRow(self, col)

      Hides the specified row.                  

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

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




      :param `col`: The row index.   
      :type `col`: int




                  





   .. method:: HideRowLabels(self)

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

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





   .. method:: 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 :meth:`CreateGrid` ) this process is automatic. If you are using a custom grid table (specified with :meth:`SetTable` ) then you must override :meth:`wx.grid.GridTableBase.InsertCols`   in your derived table class. 




      :param `pos`: The position which the first newly inserted column will have.   
      :type `pos`: int
      :param `numCols`: The number of columns to insert.   
      :type `numCols`: int
      :param `updateLabels`: Currently not used.   
      :type `updateLabels`: bool










      :rtype: `bool`



                  



      :returns: 

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








   .. method:: 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 :meth:`wx.grid.GridTableBase.InsertRows`   if you use a grid with a custom table, please see :meth:`InsertCols`   for more information. 




      :param `pos`: The position which the first newly inserted row will have.   
      :type `pos`: int
      :param `numRows`: The number of rows to insert.   
      :type `numRows`: int
      :param `updateLabels`: Currently not used.   
      :type `updateLabels`: bool










      :rtype: `bool`



                  



      :returns: 

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








   .. method:: IsCellEditControlEnabled(self)

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

      :rtype: `bool`








   .. method:: IsCellEditControlShown(self)

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

                

      :rtype: `bool`







      .. seealso:: :meth:`HideCellEditControl`     








   .. method:: IsColShown(self, col)

      Returns ``True`` if the specified column is not currently hidden.                  


      :param `col`: 
      :type `col`: int




      :rtype: `bool`








   .. method:: IsCurrentCellReadOnly(self)

      Returns ``True`` if the current cell is read-only.                  

                

      :rtype: `bool`







      .. seealso:: :meth:`SetReadOnly` , :meth:`IsReadOnly`     








   .. method:: IsEditable(self)

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

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

      :rtype: `bool`








   .. method:: IsInSelection(self, *args, **kw)

      Returns ``True`` if the given cell is selected.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **IsInSelection** `(self, row, col)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**

      
      **IsInSelection** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**






   .. method:: IsReadOnly(self, row, col)

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

                


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: `bool`







      .. seealso:: :meth:`SetReadOnly` , :meth:`IsCurrentCellReadOnly`     








   .. method:: IsRowShown(self, row)

      Returns ``True`` if the specified row is not currently hidden.                  


      :param `row`: 
      :type `row`: int




      :rtype: `bool`








   .. method:: IsSelection(self)

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

      :rtype: `bool`








   .. method:: 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 :meth:`GetSortingColumn`   returns a valid column index and not  ``NOT_FOUND`` . 

                

      :rtype: `bool`







      .. seealso:: :meth:`SetSortingColumn`     








   .. method:: IsSortingBy(self, col)

      Return ``True`` if this column is currently used for sorting.                  

                


      :param `col`: 
      :type `col`: int




      :rtype: `bool`







      .. seealso:: :meth:`GetSortingColumn`     








   .. method:: 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)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `wholeCellVisible`: 
      :type `wholeCellVisible`: bool
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**

      
      **IsVisible** `(self, coords, wholeCellVisible=True)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      :param `wholeCellVisible`: 
      :type `wholeCellVisible`: bool
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      **~~~**






   .. method:: 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)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      
      
      **~~~**

      
      **MakeCellVisible** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      
      
      **~~~**






   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: 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``.                  


      :param `expandSelection`: 
      :type `expandSelection`: bool




      :rtype: `bool`








   .. method:: MovePageDown(self)

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

      :rtype: `bool`








   .. method:: MovePageUp(self)

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

      :rtype: `bool`








   .. method:: ProcessTableMessage(self, msg)

      Receive and handle a message from the table.                  


      :param `msg`: 
      :type `msg`: wx.grid.GridTableMessage




      :rtype: `bool`








   .. method:: RefreshAttr(self, row, col)

      Invalidates the cached attribute for the given cell.                  

      For efficiency reasons, :ref:`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 :meth:`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 :ref:`wx.grid.Grid`  itself, i.e. use its :meth:`SetAttr`   and similar methods, it is only useful when using a separate custom attributes provider. 




      :param `row`: The row of the cell whose attribute needs to be queried again.   
      :type `row`: int
      :param `col`: The column of the cell whose attribute needs to be queried again.  
      :type `col`: int






                  



      .. versionadded:: 2.9.2 
     








   .. method:: 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  :ref:`wx.grid.GridCellStringRenderer`  and :ref:`wx.grid.GridCellTextEditor`  as its renderer and editor respectively :ref:`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  :meth:`wx.grid.GridTableBase.GetTypeName`   method, then :ref:`wx.grid.GridCellBoolRenderer`  and :ref:`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. 




      :param `typeName`: 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``   and   ``GRID_VALUE_CHOICE`` ), then the new registration information replaces the previously used renderer and editor.    
      :type `typeName`: string
      :param `renderer`: 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.   
      :type `renderer`: wx.grid.GridCellRenderer
      :param `editor`: The editor to use for the cells of this type. Its ownership is also taken by the grid.   
      :type `editor`: wx.grid.GridCellEditor








                  





   .. method:: 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 :ref:`wx.grid.Grid`  on a :ref:`wx.DC`  for printing or display.                  

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




      :param `dc`: The :ref:`wx.DC`  to be drawn on.   
      :type `dc`: wx.DC
      :param `pos`: The position on the :ref:`wx.DC`  where rendering should begin. If not specified drawing will begin at the :ref:`wx.DC`  MaxX() and MaxY().   
      :type `pos`: wx.Point
      :param `size`: The size of the area on the :ref:`wx.DC`  that the rendered :ref:`wx.grid.Grid`  should occupy. If not specified the drawing will be scaled to fit the available dc width or height. The :ref:`wx.grid.Grid`'s aspect ratio is maintained whether or not size is specified.   
      :type `size`: wx.Size
      :param `topLeft`: The top left cell of the block to be drawn. Defaults to ( 0, 0 ).   
      :type `topLeft`: wx.grid.GridCellCoords
      :param `bottomRight`: The bottom right cell of the block to be drawn. Defaults to row and column counts.   
      :type `bottomRight`: wx.grid.GridCellCoords
      :param `style`: A combination of values from GridRenderStyle.  
      :type `style`: int














                  



      .. versionadded:: 2.9.4 
     








   .. method:: ResetColPos(self)

      Resets the position of the columns to the default.                   





   .. method:: 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.                   





   .. method:: SelectAll(self)

      Selects all cells in the grid.                   





   .. method:: 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)`
      
      
      
      
      :param `topRow`: 
      :type `topRow`: int
      :param `leftCol`: 
      :type `leftCol`: int
      :param `bottomRow`: 
      :type `bottomRow`: int
      :param `rightCol`: 
      :type `rightCol`: int
      :param `addToSelected`: 
      :type `addToSelected`: bool
      
      
      
      
      
      
      **~~~**

      
      **SelectBlock** `(self, topLeft, bottomRight, addToSelected=False)`
      
      
      
      
      :param `topLeft`: 
      :type `topLeft`: wx.grid.GridCellCoords
      :param `bottomRight`: 
      :type `bottomRight`: wx.grid.GridCellCoords
      :param `addToSelected`: 
      :type `addToSelected`: bool
      
      
      
      
      
      
      **~~~**






   .. method:: 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.                  


      :param `col`: 
      :type `col`: int
      :param `addToSelected`: 
      :type `addToSelected`: bool







   .. method:: 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.                  


      :param `row`: 
      :type `row`: int
      :param `addToSelected`: 
      :type `addToSelected`: bool







   .. method:: SetAttr(self, row, col, attr)

      Sets the cell attributes for the specified cell.                  

      The grid takes ownership of the attribute pointer. 

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr







   .. method:: SetCellAlignment(self, *args, **kw)

      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`` .                    


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetCellAlignment** `(self, row, col, horiz, vert)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `horiz`: 
      :type `horiz`: int
      :param `vert`: 
      :type `vert`: int
      
      
      
      
      
      
      **~~~**

      
      **SetCellAlignment** `(self, align, row, col)`
      
      
      
      
      :param `align`: 
      :type `align`: int
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      
      
      **~~~**






   .. method:: SetCellBackgroundColour(self, row, col, colour)

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: 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 :ref:`wx.grid.GridCellEditor`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `editor`: 
      :type `editor`: wx.grid.GridCellEditor







   .. method:: SetCellFont(self, row, col, font)

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


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `font`: 
      :type `font`: wx.Font







   .. method:: SetCellHighlightColour(self)




      :param ``: 
      :type ``: wx.Colour







   .. method:: SetCellHighlightPenWidth(self, width)




      :param `width`: 
      :type `width`: int







   .. method:: SetCellHighlightROPenWidth(self, width)




      :param `width`: 
      :type `width`: int







   .. method:: SetCellOverflow(self, row, col, allow)

      Sets the overflow permission of the cell.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `allow`: 
      :type `allow`: bool







   .. method:: 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 :ref:`wx.grid.GridCellRenderer`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `renderer`: 
      :type `renderer`: wx.grid.GridCellRenderer







   .. method:: 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. 




      :param `row`: The row of the cell.   
      :type `row`: int
      :param `col`: The column of the cell.   
      :type `col`: int
      :param `num_rows`: Number of rows to be occupied by this cell, must be >= 1.   
      :type `num_rows`: int
      :param `num_cols`: Number of columns to be occupied by this cell, must be >= 1.   
      :type `num_cols`: int










                  



      .. seealso:: :meth:`GetCellSize`   








   .. method:: SetCellTextColour(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **SetCellTextColour** `(self, row, col, colour)`
      
      Sets the text colour for the given cell.                  
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `colour`: 
      :type `colour`: wx.Colour
      
      
      
      
      
      
      **~~~**

      
      **SetCellTextColour** `(self, val, row, col)`
      
      Sets the text colour for the given cell.                  
      
      
      :param `val`: 
      :type `val`: wx.Colour
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      
      
      **~~~**

      
      **SetCellTextColour** `(self, colour)`
      
      Sets the text colour for all cells by default.                  
      
      
      :param `colour`: 
      :type `colour`: wx.Colour
      
      
      
      
      
      
      **~~~**






   .. method:: 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 :meth:`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 :meth:`wx.grid.GridTableBase.CanSetValueAs`   and the :ref:`Grid Overview <grid overview>`  for more information.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetCellValue** `(self, row, col, s)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `s`: 
      :type `s`: string
      
      
      
      
      
      
      **~~~**

      
      **SetCellValue** `(self, coords, s)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      :param `s`: 
      :type `s`: string
      
      
      
      
      
      
      **~~~**






   .. method:: 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 :ref:`wx.grid.GridCellAttr`  cell attribute class and the :ref:`Grid Overview <grid overview>`.                  


      :param `col`: 
      :type `col`: int
      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr







   .. method:: SetColFormatBool(self, col)

      Sets the specified column to display boolean values.                  

                


      :param `col`: 
      :type `col`: int






      .. seealso:: :meth:`SetColFormatCustom`     








   .. method:: 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 :ref:`Grid Overview <grid overview>`  for more information on working with custom data types.                  


      :param `col`: 
      :type `col`: int
      :param `typeName`: 
      :type `typeName`: string







   .. method:: SetColFormatFloat(self, col, width=-1, precision=-1)

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

                


      :param `col`: 
      :type `col`: int
      :param `width`: 
      :type `width`: int
      :param `precision`: 
      :type `precision`: int






      .. seealso:: :meth:`SetColFormatCustom`     








   .. method:: SetColFormatNumber(self, col)

      Sets the specified column to display integer values.                  

                


      :param `col`: 
      :type `col`: int






      .. seealso:: :meth:`SetColFormatCustom`     








   .. method:: 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`` .                   


      :param `horiz`: 
      :type `horiz`: int
      :param `vert`: 
      :type `vert`: int







   .. method:: 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.                   


      :param `height`: 
      :type `height`: int







   .. method:: SetColLabelTextOrientation(self, textOrientation)

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


      :param `textOrientation`: 
      :type `textOrientation`: int







   .. method:: SetColLabelValue(self, col, value)

      Set the value for the given column label.                  

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


      :param `col`: 
      :type `col`: int
      :param `value`: 
      :type `value`: string







   .. method:: SetColMinimalAcceptableWidth(self, width)

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

                


      :param `width`: 
      :type `width`: int






      .. seealso:: :meth:`GetColMinimalAcceptableWidth`     








   .. method:: 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 :meth:`GetColMinimalAcceptableWidth` .                  


      :param `col`: 
      :type `col`: int
      :param `width`: 
      :type `width`: int







   .. method:: SetColPos(self, colID, newPos)

      Sets the position of the specified column.                  


      :param `colID`: 
      :type `colID`: int
      :param `newPos`: 
      :type `newPos`: int







   .. method:: SetColSize(self, col, width)

      Sets the width of the specified column.                  




      :param `col`: The column index.   
      :type `col`: int
      :param `width`: The new column width in pixels, 0 to hide the column or -1 to fit the column width to its label width.   
      :type `width`: int






                  





   .. method:: SetColSizes(self, sizeInfo)

      Restore all columns sizes.                  

      This is usually called with :ref:`wx.grid.GridSizesInfo`  object previously returned by :meth:`GetColSizes` . 

                


      :param `sizeInfo`: 
      :type `sizeInfo`: wx.grid.GridSizesInfo






      .. seealso:: :meth:`SetRowSizes`     








   .. method:: 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 :meth:`wx.HeaderCtrl.SetColumnsOrder` .                  


      :param `order`: 
      :type `order`: list of integers







   .. method:: 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`` .                   


      :param `horiz`: 
      :type `horiz`: int
      :param `vert`: 
      :type `vert`: int







   .. method:: SetDefaultCellBackgroundColour(self, colour)

      Sets the default background colour for grid cells.                  


      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: SetDefaultCellFont(self, font)

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


      :param `font`: 
      :type `font`: wx.Font







   .. method:: SetDefaultCellOverflow(self, allow)

      Sets the default overflow permission of the cells.                  


      :param `allow`: 
      :type `allow`: bool







   .. method:: SetDefaultCellTextColour(self, colour)

      Sets the current default colour for grid cell text.                  


      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: 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 :meth:`GetColMinimalAcceptableWidth` , then the minimal acceptable width is used instead of it.                  


      :param `width`: 
      :type `width`: int
      :param `resizeExistingCols`: 
      :type `resizeExistingCols`: bool







   .. method:: SetDefaultEditor(self, editor)

      Sets the default editor for grid cells.                  

      The grid will take ownership of the pointer. 

      See :ref:`wx.grid.GridCellEditor`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers.                  


      :param `editor`: 
      :type `editor`: wx.grid.GridCellEditor







   .. method:: SetDefaultRenderer(self, renderer)

      Sets the default renderer for grid cells.                  

      The grid will take ownership of the pointer. 

      See :ref:`wx.grid.GridCellRenderer`  and the :ref:`Grid Overview <grid overview>`  for more information about cell editors and renderers.                  


      :param `renderer`: 
      :type `renderer`: wx.grid.GridCellRenderer







   .. method:: 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 :meth:`GetRowMinimalAcceptableHeight` , then the minimal acceptable height is used instead of it.                  


      :param `height`: 
      :type `height`: int
      :param `resizeExistingRows`: 
      :type `resizeExistingRows`: bool







   .. method:: 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 :meth:`GoToCell`   to do this.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetGridCursor** `(self, row, col)`
      
      
      
      
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      
      
      
      
      
      
      **~~~**

      
      **SetGridCursor** `(self, coords)`
      
      
      
      
      :param `coords`: 
      :type `coords`: wx.grid.GridCellCoords
      
      
      
      
      
      
      **~~~**






   .. method:: SetGridLineColour(self, colour)

      Sets the colour used to draw grid lines.                  


      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: SetLabelBackgroundColour(self, colour)

      Sets the background colour for row and column labels.                  


      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: SetLabelFont(self, font)

      Sets the font for row and column labels.                  


      :param `font`: 
      :type `font`: wx.Font







   .. method:: SetLabelTextColour(self, colour)

      Sets the colour for row and column label text.                  


      :param `colour`: 
      :type `colour`: wx.Colour







   .. method:: 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 to set how big this extra space is                  


      :param `extraWidth`: 
      :type `extraWidth`: int
      :param `extraHeight`: 
      :type `extraHeight`: int







   .. method:: SetReadOnly(self, row, col, isReadOnly=True)

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

                


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int
      :param `isReadOnly`: 
      :type `isReadOnly`: bool






      .. seealso:: :meth:`IsReadOnly`     








   .. method:: 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 :ref:`wx.grid.GridCellAttr`  class for more information about controlling cell attributes.                  


      :param `row`: 
      :type `row`: int
      :param `attr`: 
      :type `attr`: wx.grid.GridCellAttr







   .. method:: 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`` .                   


      :param `horiz`: 
      :type `horiz`: int
      :param `vert`: 
      :type `vert`: int







   .. method:: 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.                   


      :param `width`: 
      :type `width`: int







   .. method:: SetRowLabelValue(self, row, value)

      Sets the value for the given row label.                  

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


      :param `row`: 
      :type `row`: int
      :param `value`: 
      :type `value`: string







   .. method:: SetRowMinimalAcceptableHeight(self, height)

      Sets the minimal row `height`  used by default.                  

      See :meth:`SetColMinimalAcceptableWidth`   for more information.                  


      :param `height`: 
      :type `height`: int







   .. method:: SetRowMinimalHeight(self, row, height)

      Sets the minimal `height`  for the specified `row`.                  

      See :meth:`SetColMinimalWidth`   for more information.                  


      :param `row`: 
      :type `row`: int
      :param `height`: 
      :type `height`: int







   .. method:: SetRowSize(self, row, height)

      Sets the height of the specified row.                  

      See :meth:`SetColSize`   for more information.                  


      :param `row`: 
      :type `row`: int
      :param `height`: 
      :type `height`: int







   .. method:: SetRowSizes(self, sizeInfo)

      Restore all rows sizes.                  

                


      :param `sizeInfo`: 
      :type `sizeInfo`: wx.grid.GridSizesInfo






      .. seealso:: :meth:`SetColSizes`     








   .. method:: SetScrollLineX(self, x)

      Sets the number of pixels per horizontal scroll increment.                  

      The default is 15. 

                


      :param `x`: 
      :type `x`: int






      .. seealso:: :meth:`GetScrollLineX` , :meth:`GetScrollLineY` , :meth:`SetScrollLineY`     








   .. method:: SetScrollLineY(self, y)

      Sets the number of pixels per vertical scroll increment.                  

      The default is 15. 

                


      :param `y`: 
      :type `y`: int






      .. seealso:: :meth:`GetScrollLineX` , :meth:`GetScrollLineY` , :meth:`SetScrollLineX`     








   .. method:: SetSelectionBackground(self, c)

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


      :param `c`: 
      :type `c`: wx.Colour







   .. method:: SetSelectionForeground(self, c)

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


      :param `c`: 
      :type `c`: wx.Colour







   .. method:: 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).                  


      :param `selmode`: 
      :type `selmode`: wx.grid.Grid.GridSelectionModes







   .. method:: SetSortingColumn(self, col, ascending=True)

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




      :param `col`: The column to display the sorting indicator in or  ``NOT_FOUND``   to remove any currently displayed sorting indicator.    
      :type `col`: int
      :param `ascending`: If ``True``, display the ascending sort indicator, otherwise display the descending sort indicator.  
      :type `ascending`: bool






                  



      .. seealso:: :meth:`GetSortingColumn` , :meth:`IsSortOrderAscending`     








   .. method:: 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 :meth:`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. 

                


      :param `behaviour`: 
      :type `behaviour`: wx.grid.Grid.TabBehaviour






      .. versionadded:: 2.9.5 
     








   .. method:: _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 :ref:`wx.grid.Grid`  destructor. 

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


      :param `table`: 
      :type `table`: wx.grid.GridTableBase
      :param `takeOwnership`: 
      :type `takeOwnership`: bool
      :param `selmode`: 
      :type `selmode`: wx.grid.Grid.GridSelectionModes




      :rtype: `bool`








   .. method:: SetTable(self, table, takeOwnership=False, selmode=Grid.SelectCells)

      Set the Grid Table to be used by this grid.



   .. method:: SetUseNativeColLabels(self, native=True)

      Call this in order to make the column labels use a native look by using :meth:`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 :ref:`wx.grid.Grid`  for displaying tables and not as a spread-sheet. 

                


      :param `native`: 
      :type `native`: bool






      .. seealso:: :meth:`UseNativeColHeader`     








   .. method:: ShowCellEditControl(self)

      Displays the in-place cell edit control for the current cell.                   





   .. method:: 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 :meth:`HideCol`   call. 

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

                


      :param `col`: 
      :type `col`: int






      .. seealso:: :meth:`HideCol` , :meth:`SetColSize`     








   .. method:: ShowRow(self, col)

      Shows the previously hidden row.                  

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

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

                


      :param `col`: 
      :type `col`: int






      .. seealso:: :meth:`HideRow` , :meth:`SetRowSize`     








   .. method:: UnsetSortingColumn(self)

      Remove any currently shown sorting indicator.                  

      This is equivalent to calling :meth:`SetSortingColumn`   with  ``NOT_FOUND``   first argument.                    





   .. method:: UseNativeColHeader(self, native=True)

      Enable the use of native header window for column labels.                  

      If this function is called with ``True`` argument, a :ref:`wx.HeaderCtrl`  is used instead to display the column labels instead of drawing them in :ref:`wx.grid.Grid`  code itself. This has the advantage of making the grid look and feel perfectly the same as native applications (using :meth:`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 :ref:`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 :meth:`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).                   


      :param `native`: 
      :type `native`: bool







   .. method:: XToCol(self, x, clipToMinMax=False)

      Returns the column at the given pixel position.                  




      :param `x`: The x position to evaluate.   
      :type `x`: int
      :param `clipToMinMax`: 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.   
      :type `clipToMinMax`: bool








      :rtype: `int`



                  



      :returns: 

         The column index or  ``NOT_FOUND`` .    








   .. method:: 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.                   


      :param `x`: 
      :type `x`: int




      :rtype: `int`








   .. method:: XYToCell(self, *args, **kw)

      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. 

                 



      .. seealso:: :meth:`XToCol` , :meth:`YToRow`     





      |overload| Overloaded Implementations:

      **~~~**

      
      **XYToCell** `(self, x, y)`
      
      
      
      
      :param `x`: 
      :type `x`: int
      :param `y`: 
      :type `y`: int
      
      
      
      
      :rtype: :ref:`wx.grid.GridCellCoords`
      
      
      
      
      
      
      
      **~~~**

      
      **XYToCell** `(self, pos)`
      
      
      
      
      :param `pos`: 
      :type `pos`: wx.Point
      
      
      
      
      :rtype: :ref:`wx.grid.GridCellCoords`
      
      
      
      
      
      
      
      **~~~**






   .. method:: 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.                   


      :param `y`: 
      :type `y`: int




      :rtype: `int`








   .. method:: YToRow(self, y, clipToMinMax=False)

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

      Returns  ``NOT_FOUND``   if there is no row at the  `y`  position.                  


      :param `y`: 
      :type `y`: int
      :param `clipToMinMax`: 
      :type `clipToMinMax`: bool




      :rtype: `int`








   .. attribute:: BatchCount

      See :meth:`~wx.grid.Grid.GetBatchCount`


   .. attribute:: CellHighlightColour

      See :meth:`~wx.grid.Grid.GetCellHighlightColour` and :meth:`~wx.grid.Grid.SetCellHighlightColour`


   .. attribute:: CellHighlightPenWidth

      See :meth:`~wx.grid.Grid.GetCellHighlightPenWidth` and :meth:`~wx.grid.Grid.SetCellHighlightPenWidth`


   .. attribute:: CellHighlightROPenWidth

      See :meth:`~wx.grid.Grid.GetCellHighlightROPenWidth` and :meth:`~wx.grid.Grid.SetCellHighlightROPenWidth`


   .. attribute:: ColLabelSize

      See :meth:`~wx.grid.Grid.GetColLabelSize` and :meth:`~wx.grid.Grid.SetColLabelSize`


   .. attribute:: ColLabelTextOrientation

      See :meth:`~wx.grid.Grid.GetColLabelTextOrientation` and :meth:`~wx.grid.Grid.SetColLabelTextOrientation`


   .. attribute:: ColMinimalAcceptableWidth

      See :meth:`~wx.grid.Grid.GetColMinimalAcceptableWidth` and :meth:`~wx.grid.Grid.SetColMinimalAcceptableWidth`


   .. attribute:: ColSizes

      See :meth:`~wx.grid.Grid.GetColSizes` and :meth:`~wx.grid.Grid.SetColSizes`


   .. attribute:: DefaultCellBackgroundColour

      See :meth:`~wx.grid.Grid.GetDefaultCellBackgroundColour` and :meth:`~wx.grid.Grid.SetDefaultCellBackgroundColour`


   .. attribute:: DefaultCellFont

      See :meth:`~wx.grid.Grid.GetDefaultCellFont` and :meth:`~wx.grid.Grid.SetDefaultCellFont`


   .. attribute:: DefaultCellOverflow

      See :meth:`~wx.grid.Grid.GetDefaultCellOverflow` and :meth:`~wx.grid.Grid.SetDefaultCellOverflow`


   .. attribute:: DefaultCellTextColour

      See :meth:`~wx.grid.Grid.GetDefaultCellTextColour` and :meth:`~wx.grid.Grid.SetDefaultCellTextColour`


   .. attribute:: DefaultColLabelSize

      See :meth:`~wx.grid.Grid.GetDefaultColLabelSize`


   .. attribute:: DefaultColSize

      See :meth:`~wx.grid.Grid.GetDefaultColSize` and :meth:`~wx.grid.Grid.SetDefaultColSize`


   .. attribute:: DefaultEditor

      See :meth:`~wx.grid.Grid.GetDefaultEditor` and :meth:`~wx.grid.Grid.SetDefaultEditor`


   .. attribute:: DefaultGridLinePen

      See :meth:`~wx.grid.Grid.GetDefaultGridLinePen`


   .. attribute:: DefaultRenderer

      See :meth:`~wx.grid.Grid.GetDefaultRenderer` and :meth:`~wx.grid.Grid.SetDefaultRenderer`


   .. attribute:: DefaultRowLabelSize

      See :meth:`~wx.grid.Grid.GetDefaultRowLabelSize`


   .. attribute:: DefaultRowSize

      See :meth:`~wx.grid.Grid.GetDefaultRowSize` and :meth:`~wx.grid.Grid.SetDefaultRowSize`


   .. attribute:: GridColHeader

      See :meth:`~wx.grid.Grid.GetGridColHeader`


   .. attribute:: GridColLabelWindow

      See :meth:`~wx.grid.Grid.GetGridColLabelWindow`


   .. attribute:: GridCornerLabelWindow

      See :meth:`~wx.grid.Grid.GetGridCornerLabelWindow`


   .. attribute:: GridCursorCol

      See :meth:`~wx.grid.Grid.GetGridCursorCol`


   .. attribute:: GridCursorRow

      See :meth:`~wx.grid.Grid.GetGridCursorRow`


   .. attribute:: GridLineColour

      See :meth:`~wx.grid.Grid.GetGridLineColour` and :meth:`~wx.grid.Grid.SetGridLineColour`


   .. attribute:: GridRowLabelWindow

      See :meth:`~wx.grid.Grid.GetGridRowLabelWindow`


   .. attribute:: GridWindow

      See :meth:`~wx.grid.Grid.GetGridWindow`


   .. attribute:: LabelBackgroundColour

      See :meth:`~wx.grid.Grid.GetLabelBackgroundColour` and :meth:`~wx.grid.Grid.SetLabelBackgroundColour`


   .. attribute:: LabelFont

      See :meth:`~wx.grid.Grid.GetLabelFont` and :meth:`~wx.grid.Grid.SetLabelFont`


   .. attribute:: LabelTextColour

      See :meth:`~wx.grid.Grid.GetLabelTextColour` and :meth:`~wx.grid.Grid.SetLabelTextColour`


   .. attribute:: NumberCols

      See :meth:`~wx.grid.Grid.GetNumberCols`


   .. attribute:: NumberRows

      See :meth:`~wx.grid.Grid.GetNumberRows`


   .. attribute:: RowLabelSize

      See :meth:`~wx.grid.Grid.GetRowLabelSize` and :meth:`~wx.grid.Grid.SetRowLabelSize`


   .. attribute:: RowMinimalAcceptableHeight

      See :meth:`~wx.grid.Grid.GetRowMinimalAcceptableHeight` and :meth:`~wx.grid.Grid.SetRowMinimalAcceptableHeight`


   .. attribute:: RowSizes

      See :meth:`~wx.grid.Grid.GetRowSizes` and :meth:`~wx.grid.Grid.SetRowSizes`


   .. attribute:: ScrollLineX

      See :meth:`~wx.grid.Grid.GetScrollLineX` and :meth:`~wx.grid.Grid.SetScrollLineX`


   .. attribute:: ScrollLineY

      See :meth:`~wx.grid.Grid.GetScrollLineY` and :meth:`~wx.grid.Grid.SetScrollLineY`


   .. attribute:: SelectedCells

      See :meth:`~wx.grid.Grid.GetSelectedCells`


   .. attribute:: SelectedCols

      See :meth:`~wx.grid.Grid.GetSelectedCols`


   .. attribute:: SelectedRows

      See :meth:`~wx.grid.Grid.GetSelectedRows`


   .. attribute:: SelectionBackground

      See :meth:`~wx.grid.Grid.GetSelectionBackground` and :meth:`~wx.grid.Grid.SetSelectionBackground`


   .. attribute:: SelectionBlockBottomRight

      See :meth:`~wx.grid.Grid.GetSelectionBlockBottomRight`


   .. attribute:: SelectionBlockTopLeft

      See :meth:`~wx.grid.Grid.GetSelectionBlockTopLeft`


   .. attribute:: SelectionForeground

      See :meth:`~wx.grid.Grid.GetSelectionForeground` and :meth:`~wx.grid.Grid.SetSelectionForeground`


   .. attribute:: SelectionMode

      See :meth:`~wx.grid.Grid.GetSelectionMode` and :meth:`~wx.grid.Grid.SetSelectionMode`


   .. attribute:: SortingColumn

      See :meth:`~wx.grid.Grid.GetSortingColumn` and :meth:`~wx.grid.Grid.SetSortingColumn`


   .. attribute:: Table

      See :meth:`~wx.grid.Grid.GetTable` and :meth:`~wx.grid.Grid.SetTable`


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.grid.Grid.CellSpan.enumeration
   wx.grid.Grid.TabBehaviour.enumeration
   wx.grid.Grid.GridSelectionModes.enumeration
