tooltips per grid cell

Thanks. This is exactly what I'm looking for. Problem is I couldn't get it to work in Python. It doesn't crash or anything. It just never does anything.... It should at least cough out my print stmt. Here is my code:

            gr = wx.grid.Grid(self, -1, size=(gridw,gridh), \
                              pos=(gridx, gridy+g*(gridh+gridvspace)))
            gr.CreateGrid(numrows, numcols)
            self.Bind(wx.EVT_MOTION, parent.OnGridTip, gr)

    def OnGridTip(self, event):
        col = self.XToCol(event.GetPosition().x)
        row = self.XToCol(event.GetPosition().y)
        print "on grid tip ", row, ", ", col
        self.GetGridWindow().SetToolTip(str(row) + ", " + str(col))

Phill

C. Iacob wrote:

···

Here's a C++ code displaying the column number where the mouse is, as a tooltip.

BEGIN_EVENT_TABLE(DbvalGrid, wxGrid)
    EVT_MOTION(DbvalGrid::updateToolTips)
END_EVENT_TABLE()

void DbvalGrid::updateToolTips(wxMouseEvent& event)
{
    int col = XToCol(event.GetPosition().x);
    wxString tip;
    if (col >= 0)
    { tip << col;
    }
    GetGridWindow()->SetToolTip(tip);
}

HTH,

Cristina.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org