ColorPicker

class ttkwidgets.color.ColorPicker(parent=None, color=(255, 0, 0), alpha=False, title='Color Chooser')[source]

Bases: Tkinter.Toplevel

Color picker dialog.

__init__(parent=None, color=(255, 0, 0), alpha=False, title='Color Chooser')[source]

Create a ColorPicker dialog.

Parameters:
  • parent (widget) – parent widget
  • color (sequence[int] or str) – initially selected color (RGB(A), HEX or tkinter color name)
  • alpha (bool) – whether to display the alpha channel
  • title (str) – dialog title
get_color()[source]

Return selected color, return an empty string if no color is selected.

Returns:selected color as a (RGB, HSV, HEX) tuple or “”
ok()[source]

Validate color selection and destroy dialog.