code: def _draw_gradient(self, alpha, color):
          
          self.delete("gradient")
          self.delete("cursor")
          del self.gradient
          width = self.winfo_width()
          height = self.winfo_height()
  
          bg = create_checkered_image(width, height)
          r, g, b = color
          w = width - 1.
          gradient = Image.new("RGBA", (width, height))
          for i in range(width):
              for j in range(height):
                  gradient.putpixel((i, j), (r, g, b, round2(i / w * 255)))
          self.gradient = ImageTk.PhotoImage(Image.alpha_composite(bg, gradient),
                                             master=self)
  
          self.create_image(0, 0, anchor="nw", tags="gardient",
                            image=self.gradient)
          self.lower("gradient")
  
          x = alpha / 255. * width
          h, s, v = rgb_to_hsv(r, g, b)
          if v < 50:
              fill = "gray80"
          else:
              fill = 'black'
          self.create_line(x, 0, x, height, width=2, tags='cursor', fill=fill)
docs: Draw the gradient and put the cursor on alpha.