î Óê[Æã@sƒdZddlZddlmZmZmZmZGdd„deƒZdd„Ze dkrdd l m Z e eƒndS) zd OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness éN)Ú OptionMenuÚ_setitÚ StringVarÚButtonc@s1eZdZdZdd„Zddd„ZdS)Ú DynOptionMenuzF unlike OptionMenu, our kwargs can include highlightthickness cOs…tj|ƒ}dt|jƒƒkr1|d=ntj||||||Ž|jd|jdƒƒ||_|jdƒ|_dS)NZhighlightthicknessÚcommand) ÚcopyÚlistÚkeysrÚ__init__ZconfigÚgetÚvariabler)ÚselfZmasterr ÚvalueÚvaluesÚkwargsZ kwargsCopy©rú1/usr/lib/python3.4/idlelib/dynOptionMenuWidget.pyr s  zDynOptionMenu.__init__Nc Csn|djddƒx:|D]2}|djd|dt|j||jƒƒqW|rj|jj|ƒndS)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ÚendZlabelrN)ZdeleteZ add_commandrr rÚset)rZ valueListrÚitemrrrÚSetMenus  zDynOptionMenu.SetMenu)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrrrrs  rcsÑddlm}|ƒ}|jdƒ|jd|jƒd|jƒdfƒ|jƒt|ƒ}|jdƒt ||dd d d ƒ‰ˆj ƒ‡fd d †}t |ddd|ƒ}|j ƒdS)Nr)ÚToplevelzTets dynamic option menuz 200x100+%d+%déÈé–zOld option setZold1Zold2Zold3Zold4cs#ˆjddddgddƒdS)NZnew1Znew2Znew3Znew4rznew option set)rr)ÚdynrrÚupdate2sz _dyn_option_menu..updateÚtextzChange option setr) ÚtkinterrÚtitleZgeometryZ winfo_rootxZ winfo_rootyZ focus_setrrrZpackr)ÚparentrÚtopZvarr Zbuttonr)rrÚ_dyn_option_menu$s      r&Ú__main__)Úrun) rrr"rrrrrr&rZidlelib.idle_test.htestr(rrrrÚs "