def showtip(self): # make sure tip is on the screen ToolTipBase.showtip(self) tipwindow = self.tipwindow tipwindow.update_idletasks() sw = tipwindow.winfo_screenwidth() tw = tipwindow.winfo_width() tx = tipwindow.winfo_x() ty = tipwindow.winfo_y() delta = tw + tx - sw if delta > 0: # must shift the tipwindow to the left by delta dx = tx - delta tipwindow.wm_geometry('+%d+%d' % (dx, ty))
def showcontents(self): try: text = self.text_callback() except: text = '' ToolTipBase.showcontents(self, text)
def __init__(self, button, text_callback): ToolTipBase.__init__(self, button) self.text_callback = text_callback