'Check if needs to reposition the window, and if so - do it.'

def position_window(self):

    curline = int(self.widget.index('insert').split('.')[0])
    if (curline == self.lastline):
        return
    self.lastline = curline
    self.widget.see('insert')
    if (curline == self.parenline):
        box = self.widget.bbox(('%d.%d' % (self.parenline, self.parencol)))
    else:
        box = self.widget.bbox(('%d.0' % curline))
    if (not box):
        box = list(self.widget.bbox('insert'))
        box[0] = 0
        box[2] = 0
    x = ((box[0] + self.widget.winfo_rootx()) + 2)
    y = ((box[1] + box[3]) + self.widget.winfo_rooty())
    self.tipwindow.wm_geometry(('+%d+%d' % (x, y)))
