3 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(/home/armin/python/fajho2.0/FHtooltip.py__init__szTooltipBase.__init__cCs |jdS)N)hidetip)rrrr__del__szTooltipBase.__del__c Cs||jr dSt|j|_}|jdy|jjdd|jddWntk rRYnX|j|j |jj |jj dS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStylestylehelp noActivates) rToplevelrwm_overrideredirecttkcall_wTclErrorposition_window showcontentsupdate_idletaskslift)rtwrrrshowtips   zTooltipBase.showtipcCs@|j\}}|jj|}|jj|}|jjd||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|jjdfS)z(choose a screen position for the tooltipr )r winfo_height)rrrrr8s zTooltipBase.get_positioncCstdS)z$content display hook for sub-classesN)NotImplementedError)rrrrrCszTooltipBase.showcontentsc Cs6|j}d|_|r2y |jWntk r0YnXdS)zhide the tooltipN)rdestroyr)rrrrrr 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 displaycsRtj|||_d|_|jjd|j|_|jjd|j|_ |jjd|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. Nzzz