[wxpython-users] Changing row positions in a wx.Grid
Mike Driscoll
mdriscoll at co.marshall.ia.us
Wed May 7 12:10:09 PDT 2008
David Anderson wrote:
> what?
>
> On Wed, May 7, 2008 at 3:49 PM, Chester <wxpythoner at gmail.com
> <mailto:wxpythoner at gmail.com>> wrote:
>
> There is this notion in my head that the word dictionary might
> ring a bell. :)
>
>
>
> On Wed, May 7, 2008 at 8:33 PM, David Anderson
> <zerty.david at gmail.com <mailto:zerty.david at gmail.com>> wrote:
>
> Another dumbq uestion...
> I have an Grid with lot of rows
>
> Lets suppose
>
> Name Birth
>
> David 14/09
> Denis 15/05
> Mary 06/06
>
>
> How can I Swap two rows? For instance:
>
> Name Birth
>
> David 14/09
> Mary 06/06
> Denis 15/05
>
>
> ??
>
> Thx
>
>
>
> _
>
Ignore Chester. Not sure what his deal is, but dicts probably won't help
this problem at all.
As to your original question, I'm not aware of an "easy" way to do it.
If I were you, I'd probably loop through looking for whichever rows I
want to swap and grab the information from those rows using the grid's
methods:
oneName = myGrid.GetCellValue(row, col)
oneBirth = myGrid.GetCellValue(row, col)
....
secondName
(etc...)
And then use the SetCellValue() method. There's probably a way to do it
with SQL too...
There may be a sorting method I am unaware of too, but that doesn't
appear to be what you're looking for anyway.
Mike
More information about the wxpython-users
mailing list