[wxPython-users] GridWindow
Raffaello Barella
barbarossa.platz at gmail.com
Tue Mar 18 04:17:20 PDT 2008
Here below please find my example code
import wx
import wx.grid
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title=3D"Simple Grid",
size=3D(640,480))
self.grid =3D wx.grid.Grid(self)
self.grid.CreateGrid(50,50)
for row in range(20):
for col in range(6):
self.grid.SetCellValue(row, col,
"cell (%d,%d)" % (row, col))
self.grid.GetGridColLabelWindow().SetToolTip(\
wx.ToolTip('a tooltip whatever'))
self.grid.GetGridColLabelWindow().Bind(wx.EVT_MOTION,
self.OnMouseMotion)
def OnMouseMotion(self, event):
event.Skip()
clwnd =3D self.grid.GetGridColLabelWindow()
pos =3D event.GetPosition()
if self.grid.XToCol(pos.x) =3D=3D 3:
clwnd.SetToolTip(wx.ToolTip('Col No. 3'))
else:
clwnd.SetToolTip(wx.ToolTip('a tooltip whatever'))
app =3D wx.PySimpleApp()
frame =3D TestFrame()
frame.Show()
app.MainLoop()
Try it: the tooltip in the col labels does not appear. If the binding to
OnMouseMotion is commented out, the tooltip reappears, but it is the same
for all columns, which is not what I need.
Can you tell me where is my mistake?
2008/3/18, Robin Dunn <robin at alldunn.com>:
>
> Raffaello Barella wrote:
> > For Robin:
> >
> > 1. Is it correct to construe the grid window as the grid's "face"?
>
> More or less. There are four component windows that are children of the
> main wx.Grid. The GridWindow, the GridRowLabelWindow,
> GridColLabelWindow, and the GridCornerLabelWindow
>
>
> > 2. Where can documentation for GridWindow be found?
>
> There probably isn't any.
>
> > 3. Is there a way to put a tooltip on a single grid column label
>
> > (which, I suppose, is out of the grid window)?
>
>
> You can bind appropriate events to the return value of
> theGrid.GetGridColLabelWindow() to help you do it.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200803=
18/35455145/attachment.htm
More information about the wxpython-users
mailing list