o
    ¹iå  ã                   @   s2   d Z ddlmZ ddlmZ dd„ Zd	dd„ZdS )
z¢
========================
Widget testing utilities
========================
Functions that are useful for testing widgets.
See also matplotlib.tests.test_widgets
é    N)Úmockc                  C   s>   t  dd¡\} }| ddgddg¡ | d¡ |jj ¡  |S )z!Creates plot and returns its axesé   r   éÈ   g      ð?)ÚpltÚsubplotsÚplotÚ
set_aspectÚfigureÚcanvasÚdraw)ÚfigÚax© r   úU/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/testing/widgets.pyÚget_ax   s
   
r   r   c           
      C   s„   t  ¡ }||_| j}|j ||f||fg¡d \|_|_|||_|_	||_
|jj|_||_||_d|_d|_t| |ƒ}	|	|ƒ dS )a4  
    Trigger an event

    Parameters
    ----------
    tool : matplotlib.widgets.RectangleSelector
    etype
        the event to trigger
    xdata : int
        x coord of mouse in data coords
    ydata : int
        y coord of mouse in data coords
    button : int or str
        button pressed None, 1, 2, 3, 'up', 'down' (up and down are used
        for scroll events)
    key
        the key depressed when the mouse event triggered (see
        :class:`KeyEvent`)
    step : int
        number of scroll steps (positive for 'up', negative for 'down')
    r   NÚCustom)r   ÚMockÚbuttonr   Ú	transDataÚ	transformÚxÚyÚxdataÚydataÚinaxesr	   r
   ÚkeyÚstepÚguiEventÚnameÚgetattr)
ÚtoolÚetyper   r   r   r   r   Úeventr   Úfuncr   r   r   Údo_event   s"   ÿÿ

r$   )r   r   r   Nr   )Ú__doc__Úmatplotlib.pyplotÚpyplotr   Úunittestr   r   r$   r   r   r   r   Ú<module>   s
    	