
    ^jP                       d Z ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ ddlmZ erdd	lmZ dd
lmZ  G d de          Ze                    d            G d de          Ze                    d           e                    d            G d de          Ze                    d            G d de          Ze                    d            G d de          Ze                    d           dS )z/Display different types of interactive widgets.    )annotations)TYPE_CHECKINGN)EventDispatcher)Group)Caret)IncrementalTextLayout)Batch)AbstractImagec                  :   e Zd ZdZd>d	Zd?dZed@d            Zej        dAd            ZdBdZ	edCd            Z
e
j        dDd            Z
edCd            Zej        dDd            Zed             Zej        d             ZedEd            Zej        dFd            ZedCd            ZedCd            ZedGd             ZedHd"            Zej        dId#            ZdJd$ZdKd%ZdLd(ZdLd)ZdMd+ZdMd,ZdNd/ZdOd3ZdPd4ZdQd5ZdQd6ZdRd9ZdSd;ZdSd<Zd=S )T
WidgetBasezThe base of all widgets.xintywidthheightreturnNonec                v    || _         || _        || _        || _        d | _        d | _        d | _        d| _        d S NT)_x_y_width_height_parent	_bg_group	_fg_group_enabled)selfr   r   r   r   s        M/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/gui/widgets.py__init__zWidgetBase.__init__   s>        enabledboolc                    dS )zInternal hook for setting enabled.

        Override this in subclasses to perform effects when a widget is
        enabled or disabled.
        N )r   r"   s     r   _set_enabledzWidgetBase._set_enabled         r!   c                    | j         S )aF  Get/set whether this widget is enabled.

        To react to changes in this value, override
        :py:meth:`._set_enabled` on widgets. For example, you may want
        to cue the user by:

        - Playing an animation and/or sound
        - Setting a highlight color
        - Displaying a toast or notification
        )r   r   s    r   r"   zWidgetBase.enabled%   s     }r!   new_enabledc                X    | j         |k    rd S || _         |                     |           d S N)r   r&   )r   r*   s     r   r"   zWidgetBase.enabled3   s5    =K''F#+&&&&&r!   orderc                    d S r,   r%   r   r-   s     r   update_groupszWidgetBase.update_groups:       r!   c                    | j         S )zX coordinate of the widget.)r   r)   s    r   r   zWidgetBase.x=        wr!   valuec                h    || _         |                                  |                     d|            d S Non_reposition)r   _update_positiondispatch_eventr   r4   s     r   r   zWidgetBase.xB   7    OT22222r!   c                    | j         S )zY coordinate of the widget.)r   r)   s    r   r   zWidgetBase.yH   r3   r!   c                h    || _         |                                  |                     d|            d S r6   )r   r8   r9   r:   s     r   r   zWidgetBase.yM   r;   r!   c                    | j         S )zTThe frame this widget belongs to.

        :type: `~pyglet.gui.frame.Frame`
        r   r)   s    r   parentzWidgetBase.parentS   s     |r!   c                    || _         d S r,   r?   r:   s     r   r@   zWidgetBase.parent[   s    r!   tuple[int, int]c                    | j         | j        fS )z-The x, y coordinate of the widget as a tuple.)r   r   r)   s    r   positionzWidgetBase.position_   s     wr!   valuesc                x    |\  | _         | _        |                                  |                     d|            d S r6   )r   r   r8   r9   )r   rE   s     r   rD   zWidgetBase.positiond   s>    !OT22222r!   c                    | j         S )zWidth of the widget.r   r)   s    r   r   zWidgetBase.widthj   s     {r!   c                    | j         S )zHeight of the widget.r   r)   s    r   r   zWidgetBase.heighto   s     |r!   tuple[int, int, int, int]c                V    | j         | j        | j         | j        z   | j        | j        z   fS )zBounding box of the widget.

        The "left", "bottom", "right", and "top" coordinates of the
        widget. This is expressed as (x, y, x + width, y + height).
        )r   r   r   r   r)   s    r   aabbzWidgetBase.aabbt   s)     w4;!6$,8NNNr!   int | float | boolc                     t          d          )a  Query or set the Widget's value.

        This property allows you to set the value of a Widget directly, without any
        user input.  This could be used, for example, to restore Widgets to a
        previous state, or if some event in your program is meant to naturally
        change the same value that the Widget controls.  Note that events are not
        dispatched when changing this property directly.
        Value depends on control type!NotImplementedErrorr)   s    r   r4   zWidgetBase.value}   s     ""BCCCr!   c                     t          d          )NrP   rQ   r:   s     r   r4   zWidgetBase.value   s    !"BCCCr!   c                    | j         |cxk     o| j         | j        z   k     nc o!| j        |cxk     o| j        | j        z   k     nc S r,   r   r   r   r   r   r   r   s      r   
_check_hitzWidgetBase._check_hit   [    w2222TWt{22222[tw7[7[7[7[TWt|E[7[7[7[7[[r!   c                     t          d          )Nz Unable to reposition this WidgetrQ   r)   s    r   r8   zWidgetBase._update_position   s    !"DEEEr!   symbol	modifiersc                    d S r,   r%   r   rZ   r[   s      r   on_key_presszWidgetBase.on_key_press   r1   r!   c                    d S r,   r%   r]   s      r   on_key_releasezWidgetBase.on_key_release   r1   r!   buttonsc                    d S r,   r%   r   r   r   ra   r[   s        r   on_mouse_presszWidgetBase.on_mouse_press   r1   r!   c                    d S r,   r%   rc   s        r   on_mouse_releasezWidgetBase.on_mouse_release   r1   r!   dxdyc                    d S r,   r%   r   r   r   rg   rh   ra   r[   s          r   on_mouse_dragzWidgetBase.on_mouse_drag   r1   r!   scroll_xfloatscroll_yc                    d S r,   r%   r   r   r   rl   rn   s        r   on_mouse_scrollzWidgetBase.on_mouse_scroll   r1   r!   c                    d S r,   r%   r   r   r   rg   rh   s        r   on_mouse_motionzWidgetBase.on_mouse_motion   r1   r!   c                    d S r,   r%   rV   s      r   on_mouse_enterzWidgetBase.on_mouse_enter   r1   r!   c                    d S r,   r%   rV   s      r   on_mouse_leavezWidgetBase.on_mouse_leave   r1   r!   textstrc                    d S r,   r%   r   ry   s     r   on_textzWidgetBase.on_text   r1   r!   motionc                    d S r,   r%   r   r~   s     r   on_text_motionzWidgetBase.on_text_motion   r1   r!   c                    d S r,   r%   r   s     r   on_text_motion_selectz WidgetBase.on_text_motion_select   r1   r!   N)
r   r   r   r   r   r   r   r   r   r   )r"   r#   r   r   r   r#   )r*   r#   r   r   r-   r   r   r   r   r   r4   r   r   r   )r   rB   )rE   rB   r   r   )r   rK   )r   rN   )r4   rN   r   r   r   r   r   r   r   r#   r   r   )rZ   r   r[   r   r   r   
r   r   r   r   ra   r   r[   r   r   r   r   r   r   r   rg   r   rh   r   ra   r   r[   r   r   r   
r   r   r   r   rl   rm   rn   rm   r   r   
r   r   r   r   rg   r   rh   r   r   r   r   r   r   r   r   r   ry   rz   r   r   r~   r   r   r   ) __name__
__module____qualname____doc__r    r&   propertyr"   setterr0   r   r   r@   rD   r   r   rM   r4   rW   r8   r^   r`   rd   rf   rk   rq   rt   rv   rx   r}   r   r   r%   r!   r   r   r      sd       ""          X ^' ' ' ^'       X X3 3 3 X3
    X X3 3 3 X3
   X ]  ]       X  _3 3 3 _3
    X    X O O O XO 	D 	D 	D X	D \D D D \D\ \ \ \F F F F
                                      r!   r   r7   c                       e Zd ZdZ	 	 	 d%d& fdZd'dZed(d            Zej        d)d            Zd*dZ	d+dZ
d+dZd,dZd-d Zd.d!Zd/d#Zd/d$Z xZS )0
PushButtonzInstance of a push button.

    Triggers the event 'on_press' when it is clicked by the mouse.
    Triggers the event 'on_release' when the mouse is released.
    Nr   r   r   pressedr
   	unpressedhoverAbstractImage | NonebatchBatch | NonegroupGroup | Noner   r   c                v   t                                          |||j        |j                   || _        || _        |p|| _        |pt          j        	                                | _
        || _        t          d|          }t          j                            | j        ||||          | _        d| _        dS )aK  Create a push button.

        Args:
            x:
                X coordinate of the push button.
            y:
                Y coordinate of the push button.
            pressed:
                Image to display when the button is pressed.
            unpressed:
                Image to display when the button isn't pressed.
            hover:
                Image to display when the button is being hovered over.
            batch:
                Optional batch to add the push button to.
            group:
                Optional parent group of the push button.
        r   r-   r@   )r   r   r   r   FN)superr    r   r   _pressed_img_unpressed_img
_hover_imgpygletgraphicsr	   _batch_user_groupr   spriteSprite_sprite_pressed)
r   r   r   r   r   r   r   r   bg_group	__class__s
            r   r    zPushButton.__init__   s    0 	Ay	0@AAA#',96v4466 q///}++D,?1QV^f+ggr!   c                8    | j         | j        df| j        _        d S Nr   )r   r   r   rD   r)   s    r   r8   zPushButton._update_position   s     $! 3r!   r#   c                    | j         S )z%Whether the button is pressed or not.)r   r)   s    r   r4   zPushButton.value   s     }r!   r4   c                    t          |          t          u s
J d            || _        | j        r| j        n| j        | j        _        d S )Nz*This Widget's value must be True or False.)typer#   r   r   r   r   imager:   s     r   r4   zPushButton.value   sK    E{{d"""$P"""26-XT..TEXr!   r-   c                L    t          |dz   | j                  | j        _        d S )N   r   )r   r   r   r   r/   s     r   r0   zPushButton.update_groups   s&    "4;KLLLr!   ra   r[   c                    | j         r|                     ||          sd S | j        | j        _        d| _        |                     d|            d S )NTon_press)r"   rW   r   r   r   r   r9   rc   s        r   rd   zPushButton.on_mouse_press   sV    | 	4??1a#8#8 	F!.J-----r!   c                    | j         r| j        sd S |                     ||          r| j        n| j        | j        _        d| _        |                     d|            d S NF
on_release)r"   r   rW   r   r   r   r   r9   rc   s        r   rf   zPushButton.on_mouse_release   sc    | 	4= 	F0410E0E^T__4K^L$/////r!   c                    | j         r| j        sd S | j        | j        _        d| _        |                     d|            d S r   )r"   r   r   r   r   r9   rV   s      r   rx   zPushButton.on_mouse_leave  sJ    | 	4= 	F!0L$/////r!   rg   rh   c                    | j         r| j        rd S |                     ||          r| j        n| j        | j        _        d S r,   r"   r   rW   r   r   r   r   rs   s        r   rt   zPushButton.on_mouse_motion  F    | 	t} 	F0410E0E^T__4K^r!   c                    | j         r| j        rd S |                     ||          r| j        n| j        | j        _        d S r,   r   rj   s          r   rk   zPushButton.on_mouse_drag  r   r!   widgetc                    dS )z-Event: Dispatched when the button is clicked.Nr%   r   r   s     r   r   zPushButton.on_press  r'   r!   c                    dS )z.Event: Dispatched when the button is released.Nr%   r   s     r   r   zPushButton.on_release  r'   r!   )NNN)r   r   r   r   r   r
   r   r
   r   r   r   r   r   r   r   r   r   r   r4   r#   r   r   r   r   r   r   r   )r   r   r   r   )r   r   r   r   r    r8   r   r4   r   r0   rd   rf   rx   rt   rk   r   r   __classcell__r   s   @r   r   r      s^         04'+'+" " " " " " "H4 4 4 4    X \Y Y Y \Y
M M M M. . . .0 0 0 00 0 0 0_ _ _ _
_ _ _ _
< < < <= = = = = = = =r!   r   r   r   c                  2    e Zd ZdZddZddZddZddZdS )ToggleButtonzlInstance of a toggle button.

    Triggers the event 'on_toggle' when the mouse is pressed or released.
    r   r   r   r   r
   c                J    |                      ||          r| j        n| j        S r,   )rW   r   r   rV   s      r   _get_release_imagezToggleButton._get_release_image)  s$    "&//!Q"7"7PtT=PPr!   ra   r[   r   c                    | j         r|                     ||          sd S | j         | _        | j        r| j        n|                     ||          | j        _        |                     d| | j                   d S )N	on_toggle)r"   rW   r   r   r   r   r   r9   rc   s        r   rd   zToggleButton.on_mouse_press,  s}    | 	4??1a#8#8 	F M)26-bT..TE\E\]^`aEbEbKt}=====r!   c                f    | j         r| j        rd S |                     ||          | j        _        d S r,   )r"   r   r   r   r   rc   s        r   rf   zToggleButton.on_mouse_release3  s:    | 	t} 	F!44Q::r!   r   r4   r#   c                    dS )z;Event: returns True or False to indicate the current state.Nr%   r   r   r4   s      r   r   zToggleButton.on_toggle8  r'   r!   N)r   r   r   r   r   r
   r   )r   r   r4   r#   r   r   )r   r   r   r   r   rd   rf   r   r%   r!   r   r   r   #  sx         
Q Q Q Q> > > >; ; ; ;
J J J J J Jr!   r   r   c                      e Zd ZdZ	 	 	 d,d- fdZd.dZed/d            Zej        d0d            Zd1dZ	ed2d            Z
ed2d            Zed2d            Zed2d            Zd3dZd4dZd5d"Zd6d%Zd7d(Zd5d)Zd8d+Z xZS )9SliderzInstance of a slider made of a base and a knob image.

    Triggers the event 'on_change' when the knob position is changed.
    The knob position can be changed by dragging with the mouse, or
    scrolling the mouse wheel.
    r   Nr   r   r   baser
   knobedger   r   r   r   r   r   c                   t                                          |||j        |j                   || _        || _        || _        |j        dz  | _        |j        dz  | _        t          |j        dz            | j        _
        ||z   | _        ||j        z   |j        z
  |z
  | _        || _        t          d|          }t          d|          }	t          j                            | j        ||||          | _        t          j                            | j        ||z   ||j        dz  z   ||	          | _        d| _        d| _        dS )ae  Create a slider.

        Args:
            x:
                X coordinate of the slider.
            y:
                Y coordinate of the slider.
            base:
                Image to display as the background to the slider.
            knob:
                Knob that moves to show the position of the slider.
            edge:
                Pixels from the maximum and minimum position of the slider,
                to the edge of the base image.
            batch:
                Optional batch to add the slider to.
            group:
                Optional parent group of the slider.
           r   r   r   r   r   FN)r   r    r   r   _edge	_base_img	_knob_img_half_knob_width_half_knob_heightr   anchor_y_min_knob_x_max_knob_xr   r   r   r   r   	_base_spr	_knob_spr_value
_in_update)r   r   r   r   r   r   r   r   r   fg_groupr   s             r   r    zSlider.__init__G  s.   0 	Atz4;777
 $
Q!%q"%dkAo"6"6t8tz>DJ6= q///q///--dna%W_-``--dnafaTUo]bjr-ssr!   c                   | j         | j        df| j        _        | j         | j        z   | _        | j         | j        j        z   | j        j        z
  | j        z
  | _	        | j	        | j        z
  | j
        z  dz  | j        z   | j        z   }t          | j        t          || j        z
  | j	                            }| j        | j        j        dz  z   }||df| j        _        d S )Nr   d   r   )r   r   r   rD   r   r   r   r   r   r   r   r   maxminr   r   rV   s      r   r8   zSlider._update_positions  s    "&'47A"57TZ/7T^%99DN<PPSWS]] 00DK?#EHXX[_[pp #a$*?&?AQ"R"RSSGdn+a//"#Q'r!   rm   c                    | j         S r,   )r   r)   s    r   r4   zSlider.value|  
    {r!   r4   c                    t          |          t          t          fv s
J d            || _        | j        | j        z
  |z  dz  | j        z   | j        z   }t          | j        t          || j        z
  | j                            | j	        _
        d S )Nz,This Widget's value must be an int or float.r   )r   r   rm   r   r   r   r   r   r   r   r   )r   r4   r   s      r   r4   zSlider.value  s    E{{sEl***,Z*** 00E9C?$BRRUYUjjt/Q9N5NPTP`1a1abbr!   r-   c                    t          |dz   | j                  | j        _        t          |dz   | j                  | j        _        d S Nr   r   r   )r   r   r   r   r   r/   s     r   r0   zSlider.update_groups  sD    $519T=MNNN$519T=MNNNr!   c                     | j         | j        z   S r,   )r   r   r)   s    r   _min_xzSlider._min_x  s    w##r!   c                0    | j         | j        z   | j        z
  S r,   )r   r   r   r)   s    r   _max_xzSlider._max_x  s    w$tz11r!   c                :    t          | j        | j        z
            S r,   )r   r   r   r)   s    r   _min_yzSlider._min_y  s    47T33444r!   c                Z    t          | j        | j        z   | j        j        dz  z             S )Nr   )r   r   r   r   r   r)   s    r   _max_yzSlider._max_y  s)    47T33dn6Ka6OOPPPr!   r#   c                j    | j         |cxk     o
| j        k     nc o| j        |cxk     o
| j        k     nc S r,   )r   r   r   r   rV   s      r   rW   zSlider._check_hit  sM    {Q,,,,,,,,Nq1N1N1N1N4;1N1N1N1NNr!   c                $   t          | j        t          || j        z
  | j                            | j        _        t          | j        j        | j        z
  dz  | j        | j        z
  z            | _        | 	                    d| | j                   d S )Nr   	on_change)
r   r   r   r   r   r   r   absr   r9   )r   r   s     r   _update_knobzSlider._update_knob  s    t/Q9N5NPTP`1a1abbDN,t/??3F4K[^b^nKnoppKt{;;;;;r!   ra   r[   c                    | j         sd S |                     ||          rd| _        |                     |           d S d S r   )r"   rW   r   r   rc   s        r   rd   zSlider.on_mouse_press  sR    | 	F??1a   	!"DOa     	! 	!r!   rg   rh   c                T    | j         sd S | j        r|                     |           d S d S r,   )r"   r   r   rj   s          r   rk   zSlider.on_mouse_drag  s?    | 	F? 	!a     	! 	!r!   rl   rn   c                    | j         sd S |                     ||          r,|                     | j        j        | j        z   |z              d S d S r,   )r"   rW   r   r   r   r   rp   s        r   rq   zSlider.on_mouse_scroll  s`    | 	F??1a   	Sdn.1FFQRRRRR	S 	Sr!   c                &    | j         sd S d| _        d S )NF)r"   r   rc   s        r   rf   zSlider.on_mouse_release  s    | 	Fr!   r   c                    dS )z<Event: Returns the current value when the slider is changed.Nr%   r   s      r   r   zSlider.on_change  r'   r!   )r   NN)r   r   r   r   r   r
   r   r
   r   r   r   r   r   r   r   r   r   )r   rm   )r4   rm   r   r   r   r   r   )r   r   r   r   r   r   r   )r   r   r4   rm   r   r   )r   r   r   r   r    r8   r   r4   r   r0   r   r   r   r   rW   r   rd   rk   rq   rf   r   r   r   s   @r   r   r   ?  s         '+'+	*  *  *  *  *  *  * X* * * *    X \c c c \cO O O O $ $ $ X$ 2 2 2 X2 5 5 5 X5 Q Q Q XQO O O O< < < <
! ! ! !! ! ! !S S S S       
K K K K K K K Kr!   r   r   c                  p    e Zd ZdZ	 	 	 	 	 d2d3 fdZd4dZed5d            Zej        d6d            Zed7d            Z	e	j        d8d            Z	ed7d            Z
e
j        d8d            Z
ed9d            Zej        d:d             Zd;d!Zd:d"Zd<d$Zd=d'Zd>d*Zd?d+Zd@d,ZdAd.ZdAd/ZdBd1Z xZS )C	TextEntryzInstance of a text entry widget. Allows the user to enter and submit text.

    Triggers the event 'on_commit', when the user hits the Enter or Return key.
    The current text string is passed along with the event.
       r  r  r  r   r   r   r  Nry   rz   r   r   r   r   colorrK   
text_colorcaret_colorr   r   r   r   r   r   c
           
        t           j        j                            |          | _        | j                            dt          | j        j                  d|i           | j                                        }
|
j        |
j	        z
  }|	| _
        t          d|	          }t          d|	          }dx| _        }t           j                            ||z
  ||z
  ||z   |z   ||z   |z   |||          | _        t!          | j        ||d||||          | _        t%          | j        |          | _        d| j        _        d| _        t-                                          ||||           d	S )
a  Create a text entry widget.

        Args:
            text:
                Initial text to display.
            x:
                X coordinate of the text entry widget.
            y:
                Y coordinate of the text entry widget.
            width:
                The width of the text entry widget.
            color:
                The color of the outline box in RGBA format.
            text_color:
                The color of the text in RGBA format.
            caret_color:
                The color of the caret (when it is visible) in RGBA or RGB format.
            batch:
                Optional batch to add the text entry widget to.
            group:
                Optional parent group of text entry widget.
        r   r  r   r   r   r   )r  FN)r   ry   documentUnformattedDocument_doc	set_stylelenget_fontascentdescentr   r   _padshapes	Rectangle_outliner   _layoutr   _caretvisible_focusr   r    )r   ry   r   r   r   r  r	  r
  r   r   fontr   r   r   pr   s                  r   r    zTextEntry.__init__  sW   : K(<<TBB		As49>22Wj4IJJJy!!##t|+ q///q/// 	A//!QqS%'!)VAXaZQV^cks/tt -TY1aV[cklllDL<<<#Auf-----r!   c                    | j         | j        df| j        _        | j         | j        z
  | j        | j        z
  f| j        _        d S r   )r   r   r  rD   r  r  r)   s    r   r8   zTextEntry._update_position  s>     $! 3!%49!4dg	6I!Ir!   c                    | j         j        S r,   )r  ry   r)   s    r   r4   zTextEntry.value   s    y~r!   r4   c                ^    t          |          t          u s
J d            || j        _        d S )Nz%This Widget's value must be a string.)r   rz   r  ry   r:   s     r   r4   zTextEntry.value  s/    E{{c!!!#J!!!	r!   c                    | j         S r,   rH   r)   s    r   r   zTextEntry.width	  r   r!   c                D    || _         || j        _        || j        _        d S r,   )r   r  r   r  r:   s     r   r   zTextEntry.width  s#    "#r!   c                    | j         S r,   rJ   r)   s    r   r   zTextEntry.height  s
    |r!   c                D    || _         || j        _        || j        _        d S r,   )r   r  r   r  r:   s     r   r   zTextEntry.height  s#    #$r!   r#   c                    | j         S r,   )r  r)   s    r   focuszTextEntry.focus  r   r!   c                0    |                      |           d S r,   )
_set_focusr:   s     r   r&  zTextEntry.focus!  s    r!   c                    | j         |cxk     o| j         | j        z   k     nc o!| j        |cxk     o| j        | j        z   k     nc S r,   rU   rV   s      r   rW   zTextEntry._check_hit%  rX   r!   c                N    || _         || j        _        | j        | j        _        d S r,   )r  r  r  r  layoutr:   s     r   r(  zTextEntry._set_focus(  s%    #!\r!   r-   c                    t          |dz   | j                  | j        _        t          |dz   | j                  | j        _        d S r   )r   r   r  r   r  r/   s     r   r0   zTextEntry.update_groups-  sD    #%!)D<LMMM"4;KLLLr!   rg   rh   c                    | j         sd S d S r,   )r"   rs   s        r   rt   zTextEntry.on_mouse_motion1  s    | 	F	 	r!   ra   r[   c                h    | j         sd S | j        r!| j                            ||||||           d S d S r,   )r"   r  r  rk   rj   s          r   rk   zTextEntry.on_mouse_drag5  sN    | 	F; 	HK%%aBGYGGGGG	H 	Hr!   c                    | j         sd S |                     ||          r4|                     d           | j                            ||||           d S |                     d           d S )NTF)r"   rW   r(  r  rd   rc   s        r   rd   zTextEntry.on_mouse_press;  ss    | 	F??1a   	#OOD!!!K&&q!Wi@@@@@OOE"""""r!   c                    | j         sd S | j        r]|dv r=|                     d| | j        j        j                   |                     d           d S | j                            |           d S d S )N)
	on_commitF)	r"   r  r9   r  r  ry   r(  r  r}   r|   s     r   r}   zTextEntry.on_textD  s    | 	F; 	&|####Kt|7L7QRRR&&&K%%%%%	& 	&r!   r~   c                ^    | j         sd S | j        r| j                            |           d S d S r,   )r"   r  r  r   r   s     r   r   zTextEntry.on_text_motionO  sA    | 	F; 	/K&&v.....	/ 	/r!   c                ^    | j         sd S | j        r| j                            |           d S d S r,   )r"   r  r  r   r   s     r   r   zTextEntry.on_text_motion_selectU  sA    | 	F; 	6K--f55555	6 	6r!   r   c                    dS )zGEvent: dispatches the current text when committed via Enter/Return key.Nr%   )r   r   ry   s      r   r3  zTextEntry.on_commit[  r'   r!   )r  r  r  NN)ry   rz   r   r   r   r   r   r   r  rK   r	  rK   r
  rK   r   r   r   r   r   r   r   )r   rz   )r4   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r  ry   rz   r   r   )r   r   r   r   r    r8   r   r4   r   r   r   r&  rW   r(  r0   rt   rk   rd   r}   r   r   r3  r   r   s   @r   r  r    s[         5I9G:H'+'+1. 1. 1. 1. 1. 1. 1.fJ J J J    X \   \    X \$ $ $ \$
    X ]% % % ]%
    X \   \\ \ \ \* * * *
M M M M   H H H H# # # #	& 	& 	& 	&/ / / /6 6 6 6V V V V V V V Vr!   r  r3  )r   
__future__r   typingr   r   pyglet.eventr   pyglet.graphicsr   pyglet.text.caretr   pyglet.text.layoutr   r	   pyglet.imager
   r   register_event_typer   r   r   r  r%   r!   r   <module>r?     sB   5 5 " " " " " "              ( ( ( ( ( ( ! ! ! ! ! ! # # # # # # 4 4 4 4 4 4 +%%%%%%******e e e e e e e eP    / / /_= _= _= _= _= _= _= _=D   z * * * 
  | , , ,J J J J J: J J J2      - - -}K }K }K }K }KZ }K }K }K@   ; ' ' 'ZV ZV ZV ZV ZV
 ZV ZV ZVz 
  k * * * * *r!   