question on wxgrid, cell - own cell editor

hi

i'm trying to fetch the object of a cell (like wx.textctrl instance).
but i can't grab it. is there any way how i can get a single cell and have access to "cell.getvalue(), .getid() ..." etc?

i think i need to get the wx.gridcellattr - object, but how?

thanks for your answers

daniel

Hi Daniel,

I am not sure which control you want to implement but I know that with the wxGrid control you can access individual cells, with GetCellValue(), SetCellValue(), etc. (see http://xoomer.alice.it/infinity77/wxPython/grid/wx.grid.Grid.html)

Frans

···

From: DInversini@daetwyler.com
To: wxpython-users@lists.wxwidgets.org
Date: Fri, 12 Dec 2008 13:58:57 +0100
Subject: [wxpython-users] question on wxgrid, cell - own cell editor

hi

i’m trying to fetch the object of a cell (like wx.textctrl instance).
but i can’t grab it. is there any way how i can get a single cell and have access to “cell.getvalue(), .getid() …” etc?

i think i need to get the wx.gridcellattr - object, but how?

thanks for your answers

daniel


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


Je foto’s bewerken en in elkaar laten overlopen met Windows Live Photo Gallery

Frans Stronkman <pyfrans <at> hotmail.com> writes:

Hi Daniel,

I am not sure which control you want to implement but I know that with the

wxGrid control you can access individual cells, with GetCellValue(),
SetCellValue(), etc. (see
http://xoomer.alice.it/infinity77/wxPython/grid/wx.grid.Grid.html)

hi Frans

i know that, but i would like to get the object (where i can .GetId().. ). same
access like a normal wx.textctrl.
i think that the gridcell has nothing to do with wx.textctrl, but perhaps
there's a way how to get to the inizialised cell.

daniel

> From: DInversini <at> daetwyler.com> To: wxpython-users <at>

lists.wxwidgets.org> Date: Fri, 12 Dec 2008 13:58:57 +0100> Subject:
[wxpython-users] question on wxgrid, cell - own cell editor> > hi> > i'm trying
to fetch the object of a cell (like wx.textctrl instance).> but i can't grab it.
is there any way how i can get a single cell and have access to
"cell.getvalue(), .getid() ..." etc?> > i think i need to get the
wx.gridcellattr - object, but how?> > thanks for your answers> > daniel>
_______________________________________________> wxpython-users mailing list>
wxpython-users <at> lists.wxwidgets.org>
http://lists.wxwidgets.org/mailman/listinfo/wxpython-usersJe foto's bewerken en
in elkaar laten overlopen met Windows Live Photo Gallery

···

_______________________________________________
wxpython-users mailing list
wxpython-users <at> lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Inversini, Daniel wrote:

hi

i'm trying to fetch the object of a cell (like wx.textctrl instance).
but i can't grab it. is there any way how i can get a single cell and have access to "cell.getvalue(), .getid() ..." etc?

i think i need to get the wx.gridcellattr - object, but how?

thanks for your answers

daniel

I did a little digging and I think I might have found a solution. Check out the code below:

<code>

import wx
import wx.grid

class TestFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title="Simple Grid", size=(640,480))
        grid = wx.grid.Grid(self)
        self.Bind(wx.grid.EVT_GRID_EDITOR_CREATED, self.OnGridEditorCreated)
        grid.CreateGrid(50,50)
        for row in range(20):
            for col in range(6):
                grid.SetCellValue(row, col,
                                  "cell (%d, %s)" % (row, col))
                   def OnGridEditorCreated(self, event):
        """ Bind the kill focus event to the newly instantiated cell editor """
        editor = event.GetControl()
        print 'Editor methods:\n\n'
        print dir(editor) event.Skip()

if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame = TestFrame().Show()
    app.MainLoop()

</code>

The cell editor's methods that get printed out in the OnGridEditorCreated event handler include GetId() and GetValue() methods (among others). I found this trick here: http://wiki.wxpython.org/wxGrid

Hopefully that was what you were looking for.

Mike

Mike Driscoll <mike <at> pythonlibrary.org> writes:

The cell editor's methods that get printed out in the
OnGridEditorCreated event handler include GetId() and GetValue() methods
(among others). I found this trick here: wxGrid - wxPyWiki

Hopefully that was what you were looking for.

Mike
_______________________________________________
wxpython-users mailing list
wxpython-users <at> lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

hi mike

this looks great! i didn't think about the event "editor created", i always
tried with left-down etc...

this will help me! thx a lot!

daniel