<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_color(self, color):
 """ Change gradient color and change cursor position if an alpha value is supplied. :param color: new gradient color in RGB(A) format :type color: tuple[int] """

        if len(color) == 3:
            alpha = self.get()
        else:
            alpha = color[3]
        self._draw_gradient(alpha, color[:3])