Color Entry
The tkColorChooser module can be used to specify an RGB color value.
tkColorChooser.askcolor([color [,options]]). The convenience function returns two values; the first is the color as a RGB triplet (a 3-tuple containing the red, green and blue values as integers in the range 0-255), the second a Tk color string. To preset a color when you display the dialog, you can pass a color (in either format) to the function.
If the dialog is cancelled, the function returns (None, None)
Figure 9-7. askcolor (in Swedish)
The following options can be used with the askcolor function:
Table 9-5. askcolor Options
Option |
Type |
Description |
---|---|---|
initialcolor |
color |
Color to mark as selected when dialog is displayed (given as an RGB triplet or a Tk color string). (the first argument to the convenience function). |
parent |
widget |
Which window to place the message box on top of. When the dialog is closed, the focus is returned to the parent window. |
title |
string |
Message box title. |