
    MhC                     (    d Z ddlZddlZddlZd ZdS )a  
Wrapper around the eventloop that gives some time to the Tkinter GUI to process
events when it's loaded and while we are waiting for input at the REPL. This
way we don't block the UI of for instance ``turtle`` and other Tk libraries.

(Normally Tkinter registers it's callbacks in ``PyOS_InputHook`` to integrate
in readline. ``prompt-toolkit`` doesn't understand that input hook, but this
will fix it for Tk.)
    Nc                      t           j         fd} fd}(t          d          r |             dS  |             dS dS )zj
    Inputhook for Tk.
    Run the Tk eventloop until prompt-toolkit needs to process the next input.
    c                  \   dgfd}                                                      t          j        |                                t          j                  r(d         rn                    t          j                  (                                                               dS )zv
        Run the TK eventloop until the file handler that we got from the
        inputhook becomes readable.
        Fc                      dd<   d S )NTr    )astops    a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/terminal/pt_inputhooks/tk.pydonez7inputhook.<locals>.wait_using_filehandler.<locals>.doneA   s    DGGG    r   N)createfilehandlerfileno_tkinterREADABLE
dooneevent
ALL_EVENTSdeletefilehandler)r
   r   inputhook_contextroots    @r	   wait_using_filehandlerz)inputhook.<locals>.wait_using_filehandler8   s     w	 	 	 	 	 	077998;LdSSS ooh122 	Aw  ooh122 	 	07799:::::r   c                  6                                     s                    t          j        t          j        z            r-	                     t          j        t          j        z            -t          j        d                                             dS dS )z
        Windows TK doesn't support 'createfilehandler'.
        So, run the TK eventloop and poll until input is ready.
        g{Gz?N)input_is_readyr   r   r   	DONT_WAITtimesleep)r   r   s   r	   wait_using_pollingz%inputhook.<locals>.wait_using_pollingM   s    
 $2244 	//("58J"JKK  //("58J"JKK  Jt $2244 	 	 	 	 	r   Nr   )tkinter_default_roothasattr)r   r   r   r   s   `  @r	   	inputhookr   0   s      D; ; ; ; ; ;*
 
 
 
 
 
 4,-- 	!""$$$$$     	 r   )__doc__r   r   r   r   r   r   r	   <module>r!      sF   @    -! -! -! -! -!r   