# A better way is to create our fancy button by extending the Button class. class ColorRotButton(Button):
# Brighten a color by hex 101010 and return the modified color. def brighten(self,c): ret = '#' for s in [ 1, 3, 5]: ret = ret + '%02x' % (min(int(c[s:s+2],16) + 0x10, 0xff),) return ret
# List of button colors bcolors = [ '#AA4422', '#33DD11', '#4433EE', '#AA22EE' ]
# Change the label text. Changes the color of the button in rotation. def changebut(self): color = self.bcolors.pop(); self.bcolors = [ color ] + self.bcolors self.configure(background=color, activebackground=self.brighten(color))