(self, row, col)
return
Draw a tooltip showing contents of cell
Draw a tooltip showing contents of cell
Draw a tooltip showing contents of cell
def drawTooltip(self, row, col):
        """Draw a tooltip showing contents of cell"""

        x1,y1,x2,y2 = self.getCellCoords(row,col)
        w=x2-x1
        text = self.model.getValueAt(row,col)
        if isinstance(text, dict):
            if 'link' in text:
                text = text['link']

        # If text is a number we make it a string
        if type(text) is float or type is int:
            text = str(text)
        if text == None or text == '' or len(str(text))<=10:
            return

        sfont = font.Font(family='Arial', size=12,weight='bold')
        obj = self.create_text(x1+w/1.5,y2,text=text,
                                anchor='w',
                                font=sfont,tag='tooltip')

        box = self.bbox(obj)
        x1=box[0]-1
        y1=box[1]-1
        x2=box[2]+1
        y2=box[3]+1

        rect = self.create_rectangle(x1+1,y1+1,x2+1,y2+1,tag='tooltip',fill='black')
        rect2 = self.create_rectangle(x1,y1,x2,y2,tag='tooltip',fill='lightyellow')
        self.lift(obj)
        return
def drawTooltip ( self , row , col ) : x1 , y1 , x2 , y2 = self . getCellCoords ( row , col ) w = x2 - x1 text = self . model . getValueAt ( row , col ) if isinstance ( text , dict ) : if 'link' in text : text = text [ 'link' ] # If text is a number we make it a string if type ( text ) is float or type is int : text = str ( text ) if text == None or text == '' or len ( str ( text ) ) <= 10 : return sfont = font . Font ( family = 'Arial' , size = 12 , weight = 'bold' ) obj = self . create_text ( x1 + w / 1.5 , y2 , text = text , anchor = 'w' , font = sfont , tag = 'tooltip' ) box = self . bbox ( obj ) x1 = box [ 0 ] - 1 y1 = box [ 1 ] - 1 x2 = box [ 2 ] + 1 y2 = box [ 3 ] + 1 rect = self . create_rectangle ( x1 + 1 , y1 + 1 , x2 + 1 , y2 + 1 , tag = 'tooltip' , fill = 'black' ) rect2 = self . create_rectangle ( x1 , y1 , x2 , y2 , tag = 'tooltip' , fill = 'lightyellow' ) self . lift ( obj ) return