Mini Shell

Direktori : /opt/cppython/lib/python3.8/tkinter/__pycache__/
Upload File :
Current File : //opt/cppython/lib/python3.8/tkinter/__pycache__/simpledialog.cpython-38.pyc

U

��eg�-�@s�dZddlTddlmZmZGdd�d�ZGdd�de�Zdd	�ZGd
d�de�ZGdd
�d
e�Z	dd�Z
Gdd�de�Zdd�ZGdd�de�Z
dd�Zedkr�dd�Ze�dS)a&This modules handles dialog boxes.

It contains the following public symbols:

SimpleDialog -- A simple but flexible modal dialog box

Dialog -- a base class for dialogs

askinteger -- get an integer from the user

askfloat -- get a float from the user

askstring -- get a string from the user
�)�*)�
messagebox�_get_default_rootc@sLeZdZdgddddfdd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�ZdS)�SimpleDialog�NcCs|rt||d�|_n
t|�|_|r:|j�|�|j�|�t|j�t|j|dd�|_|jjdtd�t	|j�|_
|j
��||_||_||_
|j�d|j�tt|��D]L}||}	t|j
|	||fdd�d	�}
||kr�|
jtd
d�|
jttdd�q�|j�d
|j�|�|�dS)N)�class_i�)�textZaspect�)�expand�fill�<Return>cSs
|�|�S�N)�done��self�num�r�3/opt/cppython/lib/python3.8/tkinter/simpledialog.py�<lambda>8�z'SimpleDialog.__init__.<locals>.<lambda>�r�command�)ZreliefZborderwidth)�siderr
�WM_DELETE_WINDOW)�Toplevel�root�titleZiconname�
_setup_dialogZMessage�message�packZBOTH�Frame�framer�cancel�default�bind�return_event�range�len�ButtonZconfigZRIDGE�LEFT�protocol�wm_delete_window�_set_transient)r�masterr�buttonsr$r#rrr�s�brrr�__init__ s2


�zSimpleDialog.__init__��?�333333�?c
Cs|j}|��|�|�|��|��rJ|��}|��}|��}|��}n|�	�}|�
�}d}}|��}	|��}
|||	|}|||
|}||	|�	�kr�|�	�|	}n|dkr�d}||
|�
�kr�|�
�|
}n|dkr�d}|�
d||f�|��dS)Nr�+%d+%d)r�withdraw�	transient�update_idletasksZwinfo_ismappedZwinfo_widthZwinfo_height�winfo_rootx�winfo_rootyZwinfo_screenwidthZwinfo_screenheightZwinfo_reqwidthZwinfo_reqheight�geometry�	deiconify)
rr.ZrelxZrelyZwidgetZm_widthZm_heightZm_xZm_yZw_widthZw_height�x�yrrrr-?s4

zSimpleDialog._set_transientcCs.|j��|j��|j��|j��|jSr
)r�wait_visibility�grab_set�mainloop�destroyr�rrrr�go\s




zSimpleDialog.gocCs&|jdkr|j��n|�|j�dSr
)r$r�bellr�r�eventrrrr&cs
zSimpleDialog.return_eventcCs&|jdkr|j��n|�|j�dSr
)r#rrErrCrrrr,is
zSimpleDialog.wm_delete_windowcCs||_|j��dSr
)rr�quitrrrrroszSimpleDialog.done)r3r4)	�__name__�
__module__�__qualname__r2r-rDr&r,rrrrrrs�

rc@sVeZdZdZddd�Zdd�Zdd�Zd	d
�Zddd�Zdd
d�Z	dd�Z
dd�ZdS)�DialogzZClass to open dialogs.

    This class is intended as a base class for custom dialogs
    NcCs�|}|std�}t�||�|��|dk	r>|��r>|�|�|rL|�|�t|�||_d|_	t
|�}|�|�|_|j
ddd�|��|js�||_|�d|j�|dk	r�|�d|��d|��df�|��|j��|��|��|�|�dS)z�Initialize a dialog.

        Arguments:

            parent -- a parent window (the application window)

            title -- the dialog title
        zcreate dialog windowN�)�padx�padyrr5�2)rrr2r6Zwinfo_viewabler7rr�parent�resultr!�body�
initial_focusr �	buttonboxr+r#r;r9r:r<�	focus_setr?r@Zwait_window)rrQrr.rSrrrr2{s8	


�
zDialog.__init__cCsd|_t�|�dS)zDestroy the windowN)rTrrBrCrrrrB�szDialog.destroycCsdS)z�create dialog body.

        return widget that should have initial focus.
        This method should be overridden, and is called
        by the __init__ method.
        Nr)rr.rrrrS�szDialog.bodycCsvt|�}t|dd|jtd�}|jtddd�t|dd|jd�}|jtddd�|�d|j�|�d	|j�|��d
S)z[add standard button box.

        override if you do not want the standard buttons
        ZOK�
)r�widthrr$rM)rrNrO�Cancel)rrXrrz<Escape>N)r!r)�okZACTIVEr r*r#r%)rZbox�wrrrrU�szDialog.buttonboxcCsB|��s|j��dS|��|��z|��W5|��XdSr
)�validaterTrVr6r8r#�applyrFrrrrZ�s
z	Dialog.okcCs |jdk	r|j��|��dSr
)rQrVrBrFrrrr#�s

z
Dialog.cancelcCsdS)z�validate the data

        This method is called automatically to validate the data before the
        dialog is destroyed. By default, it always validates OK.
        r	rrCrrrr\�szDialog.validatecCsdS)z�process the data

        This method is called automatically to process the data, *after*
        the dialog is destroyed. By default, it does nothing.
        NrrCrrrr]�szDialog.apply)N)N)N)rIrJrK�__doc__r2rBrSrUrZr#r\r]rrrrrLts
7	


	rLcCs:|jdkr |j�dd|dd�n|jdkr6|�dd�dS)	NZaquaz!::tk::unsupported::MacWindowStyle�styleZ
moveableModalrZx11z-typeZdialog)Z_windowingsystemZtk�callZ
wm_attributes)r[rrrrs

�
rc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�_QueryDialogNcCs*||_||_||_||_t�|||�dSr
)�prompt�minvalue�maxvalue�initialvaluerLr2)rrrbrercrdrQrrrr2s
z_QueryDialog.__init__cCsd|_t�|�dSr
)�entryrLrBrCrrrrBsz_QueryDialog.destroycCsrt||jtd�}|jddtd�t|dd�|_|jjddttd�|jdk	rl|j�	d|j�|j�
dt�|jS)N)rZjustifyrrM)�rowrNZstickyrf)�namer	)ZLabelrbr*Zgrid�WZEntryrf�Ere�insertZselect_rangeZEND)rr.r[rrrrS s
z_QueryDialog.bodycCs�z|��}Wn,tk
r8tjd|jd|d�YdSX|jdk	rh||jkrhtjdd|j|d�dS|jdk	r�||jkr�tjdd|j|d�dS||_d	S)
Nz
Illegal valuez
Please try again)rQrz	Too smallz2The allowed minimum value is %s. Please try again.z	Too largez2The allowed maximum value is %s. Please try again.r	)�	getresult�
ValueErrorr�showwarning�errormessagercrdrR)rrRrrrr\.s:�����z_QueryDialog.validate)NNNN)rIrJrKr2rBrSr\rrrrra
s�

rac@seZdZdZdd�ZdS)�
_QueryIntegerzNot an integer.cCs|�|j���Sr
)Zgetintrf�getrCrrrrlSsz_QueryInteger.getresultN�rIrJrKrorlrrrrrpPsrpcKst||f|�}|jS)z�get an integer from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is an integer
    )rprR�rrb�kw�drrr�
askintegerWsrvc@seZdZdZdd�ZdS)�_QueryFloatzNot a floating point value.cCs|�|j���Sr
)Z	getdoublerfrqrCrrrrlisz_QueryFloat.getresultNrrrrrrrwfsrwcKst||f|�}|jS)z�get a float from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a float
    )rwrRrsrrr�askfloatmsrxc@s$eZdZdd�Zdd�Zdd�ZdS)�_QueryStringcOs6d|kr|d|_|d=nd|_tj|f|�|�dS)N�show)�_QueryString__showrar2)r�argsrtrrrr2}s

z_QueryString.__init__cCs(t�||�}|jdk	r$|j|jd�|S)N)rz)rarSr{Z	configure)rr.rfrrrrS�s
z_QueryString.bodycCs
|j��Sr
)rfrqrCrrrrl�sz_QueryString.getresultN)rIrJrKr2rSrlrrrrry|srycKst||f|�}|jS)z�get a string from the user

    Arguments:

        title -- the dialog title
        prompt -- the label text
        **kw -- see SimpleDialog class

    Return value is a string
    )ryrRrsrrr�	askstring�sr}�__main__cCsLt�}|fdd�}t|d|d�}|��t|d|jd�}|��|��dS)NcSs^t|ddddgdddd�}t|���ttd	d
dd��ttd	d
ddd��ttd	d��dS)Nz�This is a test dialog.  Would this have been an actual dialog, the buttons below would have been glowing in soft pink light.
Do you believe this?ZYesZNorYr�zTest Dialog)rr/r$r#rZSpamz	Egg count�)rezEgg weight
(in tons)r	�d)rcrdz	Egg label)r�printrDrvrxr})rrurrr�doit�s�

�ztest.<locals>.doitZTestrZQuit)ZTkr)r rHrA)rr��t�qrrr�test�sr�N)r^�tkinterrrrrrLrrarprvrwrxryr}rIr�rrrr�<module>s V
C

Zerion Mini Shell 1.0