PEATDB/Tables.py
def draw_tooltip(self, row, col):
        """Draw a tooltip showing contents of cell"""

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


        # If text is a number we make it a string
        import types
        if type(text) is types.FloatType or type is types.IntType:
            text=str(text)
        if text == NoneType or text == '' or len(str(text))<=3:
            return
        import tkFont
        sfont = tkFont.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
Draw a tooltip showing contents of cell
Draw a tooltip showing contents of cell
Draw a tooltip showing contents of cell
def draw_tooltip(self, row, col):
        absrow = self.get_AbsoluteRow(row)
        x1,y1,x2,y2 = self.getCellCoords(row,col)
        w=x2-x1
        text = self.model.getValueAt(absrow,col)
        if isinstance(text, dict):
            if text.has_key('link'):
                text = text['link']
        import types
        if type(text) is types.FloatType or type is types.IntType:
            text=str(text)
        if text == NoneType or text == '' or len(str(text))<=3:
            return
        import tkFont
        sfont = tkFont.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 draw_tooltip ( self , row , col ) : absrow = self . get_AbsoluteRow ( row ) x1 , y1 , x2 , y2 = self . getCellCoords ( row , col ) w = x2 - x1 text = self . model . getValueAt ( absrow , col ) if isinstance ( text , dict ) : if text . has_key ( 'link' ) : text = text [ 'link' ] import types if type ( text ) is types . FloatType or type is types . IntType : text = str ( text ) if text == NoneType or text == '' or len ( str ( text ) ) <= 3 : return import tkFont sfont = tkFont . 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
Draw a tooltip showing contents of cell
Draw a tooltip showing contents of cell
"""Draw a tooltip showing contents of cell""" # If text is a number we make it a string
self
row
col