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 |
---|---|
|
Sets the starting color to display in the color picker. |
|
Specifies the parent of the dialog. The dialog is displayed on top of the parent. |
|
Sets the text to be displayed in the dialog title bar. |
How to do it…
In the following example, we will create a frame and then display a color picker dialog and assign the return...