<s> from tkCommonDialog import Dialog <EOL> class Chooser ( Dialog ) : <EOL> "<STR_LIT>" <EOL> command = "<STR_LIT>" <EOL> def _fixoptions ( self ) : <EOL> try : <EOL> color = self . options [ "<STR_LIT>" ] <EOL> if type ( color ) == type ( ( ) ) : <EOL> self . options [ "<STR_LIT>" ] = "<STR_LIT>" % color <EOL> except KeyError : <EOL> pass <EOL> def _fixresult ( self , widget , result ) : <EOL> if not result : <EOL> return None , None <EOL> r , g , b = widget . winfo_rgb ( result ) <EOL> return ( r / <NUM_LIT> , g / <NUM_LIT> , b / <NUM_LIT> ) , result <EOL> def askcolor ( color = None , ** options ) : <EOL> "<STR_LIT>" <EOL> if color : <EOL> options = options . copy ( ) <EOL> options [ "<STR_LIT>" ] = color <EOL> return Chooser ( ** options ) . show ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> print "<STR_LIT>" , askcolor ( ) </s>
