Tkinter Buttons's command don't working after bind_class

Viewed 31

I am trying to make my gui more beatifull and there is problem with bind_class.

My bind_class code is below;

mainWindow.bind_class('Button', '<Enter>', onCursorButton)
mainWindow.bind_class('Button', '<Leave>', notCursorButton, add='+')

Here's my functions;

def onCursorButton(event):
  lighter = hex_to_hsv(event.widget['background'])
  lighter_list = list(lighter)
  if not (lighter[1]-0.4) <= 0:
    lighter_list[1] = lighter_list[1]-0.4
  if not (lighter[2]+0.4) >= 1:
    lighter_list[2] = lighter_list[2]+0.4
  lighter = tuple(lighter_list)
  event.widget.config(bg=hsv_to_hex(lighter))

def notCursorButton(event):
  event.widget.config(bg=generalBtnColor)

This function is work better than I execpted but after, these buttons's own command is not working.

bgButton = tk.Button(themeWindow, text=' ', relief='ridge',
                     bg=generalBgColor, width=6, command=lambda: pickColor(1, generalBgColor))

fgButton = tk.Button(themeWindow, text=' ', relief='ridge',
                     bg=generalFgColor, width=6, command=lambda: pickColor(2, generalFgColor))

btnButton = tk.Button(themeWindow, text=' ', relief='ridge',
                      bg=generalBtnColor, width=6, command=lambda: pickColor(3, generalBtnColor))

And yes, normally this buttons were perfect working.

0 Answers
Related