관리-도구
편집 파일: dynOptionMenuWidget.cpython-34.pyo
� e f� � @ s� d Z d d l Z d d l m Z m Z m Z m Z Gd d � d e � Z d d � Z e d k r d d l m Z e e � n d S) zd OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness � N)� OptionMenu�_setit� StringVar�Buttonc @ s1 e Z d Z d Z d d � Z d d d � Z d S)� DynOptionMenuzF unlike OptionMenu, our kwargs can include highlightthickness c O s� t j | � } d t | j � � k r1 | d =n t j | | | | | | � | j d | j d � � | | _ | j d � | _ d S)NZhighlightthickness�command) �copy�list�keysr �__init__�config�get�variabler )�selfZmasterr �value�values�kwargsZ kwargsCopy� r �@/opt/alt/python34/lib64/python3.4/idlelib/dynOptionMenuWidget.pyr s zDynOptionMenu.__init__Nc C sn | d j d d � x: | D]2 } | d j d | d t | j | | j � � q W| rj | j j | � n d S)z� clear and reload the menu with a new set of options. valueList - list of new options value - initial value to set the optionmenu's menubutton to Zmenur �endZlabelr N)ZdeleteZadd_commandr r r �set)r Z valueListr �itemr r r �SetMenu s zDynOptionMenu.SetMenu)�__name__� __module__�__qualname__�__doc__r r r r r r r s r c s� d d l m } | � } | j d � | j d | j � d | j � d f � | j � t | � } | j d � t | | d d d d � � � j � � f d d � } t | d d d | �} | j � d S)Nr )�ToplevelzTets dynamic option menuz 200x100+%d+%d�� � zOld option setZold1Zold2Zold3Zold4c s# � j d d d d g d d �d S)NZnew1Znew2Znew3Znew4r znew option set)r r )�dynr r �update2 s z _dyn_option_menu.<locals>.update�textzChange option setr )�tkinterr �titleZgeometryZwinfo_rootxZwinfo_rootyZ focus_setr r r Zpackr )�parentr �top�varr! Zbuttonr )r r �_dyn_option_menu$ s r( �__main__)�run)r r r# r r r r r r( r Zidlelib.idle_test.htestr* r r r r �<module> s "