Displaying the color picker

The tk_chooseColor command displays a dialog window that allows the user to select a color. The actual appearance of the color picker will vary, based on the display manager in use. The return hexadecimal value of the color selected is returned. If the user clicks on the Cancel button, an empty string is returned.

The syntax is as follows:

	tk_chooseColor option value …

The tk_chooseColor command accepts one or more option value pairs as detailed in the following table. If no option value pairs are provided, the command will display a dialog with the default values.

Option

Interpretation

-initialcolor color

Sets the starting color to display in the color picker.

-parent window

Specifies the parent of the dialog. ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.