Copying grid data into clipboard

Hi,

I want users to be able to copy blocks of grid data and copy it into the clipboard. I am checking to see if there is a built-in way of doing this or whether I need to assemble it myself. I suspect the latter but I want to make sure before embarking on that process.

The assembled way I can think of involves:

grid.GetSelectedCells() # I will probably only allow block-like selections suitable for pasting into spreadsheets etc
grid.GetSelectedRows() # not necessarily contiguous
grid.GetSelectedRows()# not necessarily contiguous
grid.GetSelectionBlockTopLeft()
grid.GetSelectionBlockBottomRight()
wx.EVT_GRID_RANGE_SELECT
evt.GetTopLeftCoords(),
evt.GetBottomRightCoords()

The following looked interesting too:

http://ginstrom.com/scribbles/2008/09/07/getting-the-selected-cells-from-a-wxpython-grid/
http://wiki.wxpython.org/wxGrid#Selection_Set_Management
From: http://www.blog.pythonlibrary.org/2010/03/18/wxpython-an-introduction-to-grids/

All the best, Grant

Hi,

I should also have mentioned this project: Python wx.Grid Edit Mixin download | SourceForge.net.
From the site, it"Enhances wx.grid to provide functionality for cut/
copy/paste and undo/redo. Implemented as mixin."

Here is the most recent code (about 6 months old):

Has anyone here used it? If it lives up to its advertising it could
be perfect.

All the best, Grant

···

On Jul 15, 7:30 pm, Grant Paton-Simpson <gr...@p-s.co.nz> wrote:

Hi,

I want users to be able to copy blocks of grid data and copy it into the
clipboard. I am checking to see if there is a built-in way of doing
this or whether I need to assemble it myself. I suspect the latter but
I want to make sure before embarking on that process.

The assembled way I can think of involves:

grid.GetSelectedCells() # I will probably only allow block-like
selections suitable for pasting into spreadsheets etc
grid.GetSelectedRows() # not necessarily contiguous
grid.GetSelectedRows()# not necessarily contiguous
grid.GetSelectionBlockTopLeft()
grid.GetSelectionBlockBottomRight()
wx.EVT_GRID_RANGE_SELECT
evt.GetTopLeftCoords(),
evt.GetBottomRightCoords()

The following looked interesting too:

http://ginstrom.com/scribbles/2008/09/07/getting-the-selected-cells-f...http://wiki.wxpython.org/wxGrid#Selection_Set_Management
From:wxPython: An Introduction to Grids - Mouse Vs Python

All the best, Grant