Tooltip not showing on dataviewctrl

hello, I cannot display tooltips on dataviewctrl. I’ve added these lines to DVC_DataViewModel sample in the TestPanel’s init:

        # Create a dataview control
        self.dvc = dv.DataViewCtrl(self,
                                   | dv.DV_ROW_LINES # nice alternating bg colors
                                   #| dv.DV_HORIZ_RULES
                                   | dv.DV_VERT_RULES
                                   | dv.DV_MULTIPLE
        self.tt1 = wx.ToolTip("This is a wx.ToolTip.")

What is wrong with this? I’m on win10, stock python 3.7, wxpython 4.0.7-post1


On Windows the DVC is implemented as a composite widget, with one child for the column headers, and another for the main content of the window. You can see this if you look at the DVC widget in the Widget Inspection Tool. So what is probably happening is that the self.dvc in your example is never seeing the mouse events that would normally trigger the display of the tool tip.

To work around this implementation difference on Windows you could find the child and set the tooltip there, like this:

    w = self.dvc.FindWindow('wxdataviewctrlmainwindow')
    if w:
        w.SetToolTip('Hello World')

I found the window by name (also discoverable in the WIT) in order to help future proof it in case the layout or nature of the child widgets ever changes.

thank you very much