
   y<-ߪ                   ^    d dl mZ ddgZ G d de      Zd	dZedk(  r ed e              yy)
    )DialogChooseraskcolorc                        e Zd ZdZdZd Zd Zy)r   a  Create a dialog for the tk_chooseColor command.

    Args:
        master: The master widget for this dialog.  If not provided,
            defaults to options['parent'] (if defined).
        options: Dictionary of options for the tk_chooseColor call.
            initialcolor: Specifies the selected color when the
                dialog is first displayed.  This can be a tk color
                string or a 3-tuple of ints in the range (0, 255)
                for an RGB triplet.
            parent: The parent window of the color dialog.  The
                color dialog is displayed on top of this.
            title: A string for the title of the dialog box.
    tk_chooseColorc                     	 | j                   d   }t        |t              rd|z  | j                   d<   yy# t        $ r Y yw xY w)zvEnsure initialcolor is a tk color string.

        Convert initialcolor from a RGB triplet to a color string.
        initialcolorz#%02x%02x%02xN)options
isinstancetupleKeyError)selfcolors     2/tmp/python/lib/python3.12/tkinter/colorchooser.py_fixoptionszChooser._fixoptions#   sK    
	LL0E%'/>/F^, (  		s   15 	A Ac                 z    |rt        |      sy|j                  |      \  }}}|dz  |dz  |dz  ft        |      fS )zAdjust result returned from call to tk_chooseColor.

        Return both an RGB tuple of ints in the range (0, 255) and the
        tk color string in the form #rrggbb.
        )NN   )str	winfo_rgb)r   widgetresultrgbs         r   
_fixresultzChooser._fixresult0   sJ     S[ ""6*1a333'V44    N)__name__
__module____qualname____doc__commandr   r    r   r   r   r      s     G5r   Nc                 b    | r|j                         }| |d<   t        di |j                         S )zDisplay dialog window for selection of a color.

    Convenience wrapper for the Chooser class.  Displays the color
    chooser dialog with color as the initial value.
    r	   r"   )copyr   show)r   r
   s     r   r   r   D   s3     ,,."'W""$$r   __main__r   )N)tkinter.commondialogr   __all__r   r   r   printr"   r   r   <module>r*      sA    (j
!-5f -5f%" z	'8: r   