Color Dialog

Find Dialog Sample

Creating the Dialog

Create a Color Dialog by calling dialog.colorDialog with the single argument "self", representing the window or background that is the parent for the dialog.
Example:

Above dialog was created with this line of code:

result = dialog.colorDialog(self)

Interacting With the Dialog

The colorDialog component returns a wxPython DialogResults object which contains 2 attributes, as shown in the following table

Name of value
Description
accepted
True = user clicked OK
False = user clicked Cancel
color
Tuple of three elements containing the red, blue, and green values representing the color (i.e., RGB format)

Example:

The sample dialog shown at the top of this page returns the following results:

accepted: True
Color: (64, 128, 128)