%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/tooltip.cpython-38.pyc

U

qa@s|dZddlTGdddZGdddeZGdddeZd	d
ZedkrxddlmZed
dddddl	m
Z
e
edS)zTools for displaying tool-tips.

This includes:
 * an abstract base-class for different kinds of tooltips
 * a simple text-only Tooltip class
)*c@sHeZdZdZddZddZddZdd	Zd
dZd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+/usr/local/lib/python3.8/idlelib/tooltip.py__init__
szTooltipBase.__init__cCs|dS)Nhidetiprrrr__del__szTooltipBase.__del__cCs||jr
dSt|j|_}|dz|jdd|jddWntk
rRYnX||	|j
|jdS)zdisplay the tooltipNz!::tk::unsupported::MacWindowStylestylehelpZnoActivates)rToplevelrZwm_overrideredirectZtkcallZ_wTclErrorposition_windowshowcontentsZupdate_idletasksZliftrZtwrrrshowtips

zTooltipBase.showtipcCs@|\}}|j|}|j|}|jd||fdS)z&(re)-set the tooltip's screen position+%d+%dN)get_positionrZwinfo_rootxZwinfo_rootyrZwm_geometry)rxyZroot_xZroot_yrrrr/szTooltipBase.position_windowcCsd|jdfS)z(choose a screen position for the tooltipr)rZwinfo_heightrrrrr6s	zTooltipBase.get_positioncCstdS)z$content display hook for sub-classesN)NotImplementedErrorrrrrrAszTooltipBase.showcontentscCs6|j}d|_|r2z|Wntk
r0YnXdSzhide the tooltipN)rZdestroyrrrrrrFszTooltipBase.hidetipN)__name__
__module____qualname____doc__r	r
rrrrrrrrrr
s
rcs^eZdZdZdfdd	ZfddZddd	Zdd
dZdd
ZddZ	fddZ
ZS)OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displaycsVtt||||_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<Enter><Leave><Button>)superr#r	hover_delay	_after_idrbind_show_event_id1_hide_event_id2_id3)rrr)	__class__rrr	Us
zOnHoverTooltipBase.__init__cs\z4|jd|j|jd|j|jd|jWntk
rHYnXtt|dS)Nr%r&r')	rZunbindr-r/r0rr(r#r
rr1rrr
gszOnHoverTooltipBase.__del__NcCs|jr|n|dS)z$event handler to display the tooltipN)r)schedulerreventrrrr,ps
zOnHoverTooltipBase._show_eventcCs|dS)z!event handler to hide the tooltipNr
r4rrrr.wszOnHoverTooltipBase._hide_eventcCs ||j|j|j|_dS)z*schedule the future display of the tooltipN)
unschedulerZafterr)rr*rrrrr3{s
zOnHoverTooltipBase.schedulecCs |j}d|_|r|j|dS)z(cancel the future display of the tooltipN)r*rZafter_cancel)rZafter_idrrrr6szOnHoverTooltipBase.unschedulecs4z|Wntk
r YnXtt|dSr)r6rr(r#rrr1rrrs
zOnHoverTooltipBase.hidetip)r$)N)N)rr r!r"r	r
r,r.r3r6r
__classcell__rrr1rr#Rs	

r#cs*eZdZdZdfdd	ZddZZS)HovertipzAA tooltip that pops up when a mouse hovers over an anchor widget.r$cstt|j||d||_dS)avCreate a text 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.
        r)N)r(r8r	text)rrr:r)r1rrr	s
zHovertip.__init__cCs$t|j|jtdtdd}|dS)Nz#ffffe0r)r:ZjustifyZ
backgroundZreliefZborderwidth)Labelrr:ZLEFTZSOLIDpack)rlabelrrrrszHovertip.showcontents)r$)rr r!r"r	rr7rrr1rr8s
r8cCst|}|dtt|ddd\}}|d||dft|dd}|t|dd}|t	|d	d
dt|dd}|t	|d
dddS)NzTest tooltip+rrzPlace your mouse over buttons)r:z"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.ir9zButton 2 -- no hover delayz!This is tooltip
text for button2.)
rtitlemapintZgeometrysplitr;r<ZButtonr8)parenttoprrr=Zbutton1Zbutton2rrr_tooltips
 rF__main__)mainzidlelib.idle_test.test_tooltipF)	verbosityexit)runN)r"tkinterrr#r8rFrZunittestrHZidlelib.idle_test.htestrLrrrr<module>sH?

Zerion Mini Shell 1.0