Your IP : 18.223.239.65
3
� f�0 � @ s� d Z ddlZddlZddlmZmZ ddlmZmZm Z m
Z
mZ ddlm
Z
mZmZmZ ddlmZ ddlmZ G dd � d e�ZG d
d� de�ZG dd
� d
e�ZG dd� de�Zedkr�ddlmZ edddd� ddlmZ eee� dS )a�
Dialogs that query users and verify the answer before accepting.
Use ttk widgets, limiting use to tcl/tk 8.5+, as in IDLE 3.6+.
Query is the generic base class for a popup dialog.
The user must either enter a valid answer or close the dialog.
Entries are validated when <Return> is entered or [Ok] is clicked.
Entries are ignored when [Cancel] or [X] are clicked.
The 'return value' is .result set to either a valid answer or None.
Subclass SectionName gets a name for a new config file section.
Configdialog uses it for new highlight theme and keybinding set names.
Subclass ModuleName gets a name for File => Open Module.
Subclass HelpSource gets menu item and path for additions to Help menu.
� N)�
executable�platform)�Toplevel� StringVar�W�E�S)�Frame�Button�Entry�Label)�
filedialog)�Fontc sb e Zd ZdZdi ddd�dd�Zdd� Zdd
d�Zdd
� Zddd�Zddd�Z � fdd�Z
� ZS )�QueryzoBase class for getting verified answer from a user.
For this base class, accept any non-blank string.
� F)�text0�
used_names�_htest�_utestc
C sX t j| |� | j� || _| j|� || _|| _|| _| j|� | j � | j
jdd�}|dkr�y| j
jdd| jdd� W n Y nX | j
d| j� | j
d | j� | jd
| j� | j
d| j� | j
d| j� | jd
d
d� | j� | j� | jd|j� |j� d | j� d |j� |�s2|j� d | j� d nd f � |�sT| j� | j� dS )a� Create popup, do not return until tk widget destroyed.
Additional subclass init must be done before calling this
unless _utest=True is passed to suppress wait_window().
title - string, title of popup dialog
message - string, informational message to display
text0 - initial value for entry
used_names - names already in use
_htest - bool, change box location when running htest
_utest - bool, leave window hidden and not modal
�tk�windowingsystemZaquaz!::tk::unsupported::MacWindowStyleZstyleZ
moveableModalr z<Command-.>z<Key-Escape>ZWM_DELETE_WINDOWz<Key-Return>z
<KP_Enter>F)Zheight�widthz+%d+%d� � N)r �__init__Zwithdraw�parent�title�messager r Z transientZgrab_setr ZcallZ_wZbind�cancelZprotocol�okZ resizable�create_widgetsZupdate_idletasksZgeometryZwinfo_rootxZwinfo_widthZwinfo_reqwidthZwinfo_rootyZwinfo_heightZwinfo_reqheightZ deiconifyZwait_window) �selfr r r r r r r r � r"