a e@s>dZddlTGdddZGdddeZGdddeZd S) zTools for displaying tool-tips. This includes: * an abstract base-class for different kinds of tooltips * a simple text-only Tooltip class Source from idlelib: https://fossies.org/linux/Python/Lib/idlelib/tooltip.py )*c@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS) TooltipBasez abstract base class for tooltipscCs||_d|_dS)zCreate a tooltip. anchor_widget: the widget next to which the tooltip will be shown Note that a widget will only be shown when showtip() is called. N) anchor_widget tipwindow)selfrr#/u1/labor_progs/Fajho2/FHtooltip.py__init__szTooltipBase.__init__cCs |dS)Nhidetiprrrr__del__szTooltipBase.__del__cCsz|jr dSt|j|_}|dz|jdd|jddWntyPYn0|| |j |j dS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStylestylehelp noActivates) rToplevelrwm_overrideredirecttkcall_wTclErrorposition_window showcontentsupdate_idletasksliftrtwrrrshowtips   zTooltipBase.showtipcCs@|\}}|j|}|j|}|jd||fdS)z&(re)-set the tooltip's screen positionz+%d+%dN) get_positionr winfo_rootx winfo_rootyr wm_geometry)rxyZroot_xZroot_yrrrr1s zTooltipBase.position_windowcCsd|jdfS)z(choose a screen position for the tooltipr)r winfo_heightr rrrr8s zTooltipBase.get_positioncCstdS)z$content display hook for sub-classesN)NotImplementedErrorr rrrrCszTooltipBase.showcontentscCs4|j}d|_|r0z |Wnty.Yn0dSzhide the tooltipN)rdestroyrrrrrr Hs  zTooltipBase.hidetipN) __name__ __module__ __qualname____doc__r r rrrrr rrrrr s  rcs\eZdZdZfddZfddZdddZdd d Zd d Zd dZ fddZ Z S)OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displaycsRt|||_d|_|jd|j|_|jd|j|_ |jd|j|_ dS)aqCreate a tooltip with a mouse hover delay. anchor_widget: the widget next to which the tooltip will be shown hover_delay: time to delay before showing the tooltip, in milliseconds Note that a widget will only be shown when showtip() is called, e.g. after hovering over the anchor widget with the mouse for enough time. N