a
    ze                     @   sX   d dl Z d dlmZmZmZmZ G dd deZdd ZedkrTd dl	m
Z
 e
e dS )	    N)
OptionMenu_setit	StringVarButtonc                   @   s   e Zd Zdd ZdddZdS )DynOptionMenuc                 O   sf   t  |}dt| v r |d= tj| |||g|R i | | j|dd || _|d| _d S )Nhighlightthickness)r   command)	copylistkeysr   __init__Zconfiggetvariabler   )selfZmasterr   valuevalueskwargsZ
kwargsCopy r   '/usr/lib/python3.9/idlelib/dynoption.pyr      s    
zDynOptionMenu.__init__Nc                 C   sL   | d  dd |D ]"}| d j|t| j|| jd q|rH| j| d S )NZmenur   end)Zlabelr   )deleteZadd_commandr   r   r   set)r   Z	valueListr   itemr   r   r   SetMenu   s    
zDynOptionMenu.SetMenu)N)__name__
__module____qualname__r   r   r   r   r   r   r   	   s   r   c                    s   ddl m} || }|d tt|  ddd  \}}|d|d |d f  |  t|}|	d	 t
||d
ddd     fdd}t|d|d}|  d S )Nr   )ToplevelzTets dynamic option menu+   z200x100+%d+%d      zOld option setZold1Zold2Zold3Zold4c                      s    j g ddd d S )N)Znew1Znew2Znew3Znew4znew option set)r   )r   r   Zdynr   r   update3   s    z _dyn_option_menu.<locals>.updatezChange option set)textr   )tkinterr   titlemapintZgeometrysplitZ	focus_setr   r   r   packr   )parentr   topxyvarr#   Zbuttonr   r"   r   _dyn_option_menu%   s    
 
r0   __main__)run)r	   r%   r   r   r   r   r   r0   r   Zidlelib.idle_test.htestr2   r   r   r   r   <module>   s   