GradientBar

class ttkwidgets.color.GradientBar(parent, hue=0, height=11, width=256, variable=None, **kwargs)[source]

Bases: Tkinter.Canvas

HSV gradient colorbar with selection cursor.

__init__(parent, hue=0, height=11, width=256, variable=None, **kwargs)[source]

Create a GradientBar.

Parameters:
  • parent (widget) – parent widget
  • hue (int) – initially selected hue value (between 0 and 360)
  • variable (IntVar) – variable linked to the hue value
  • height (int) – height of the widget in pixels
  • width (int) – width of the widget in pixels
  • kwargs – options to be passed on to the tk.Canvas initializer
get()[source]

Return hue of color under cursor.

set(hue)[source]

Set cursor position on the color corresponding to the hue value.

Parameters:hue (int) – new hue value (between 0 and 360)