I am currently trying to implement code into my program to update a buttons color when the user hovers the mouse cursor over it. The program recognizes the hover, but returns an error.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1482, in __call__
return self.func(*args)
File "C:\Users\oiest\Documents\Programs\iNTMI\v1.1.3b\iNTMI.py", line 252, in <lambda>
achievementsButton.bind("<Enter>", lambda event: achievementsButton.configure(bg = "red"))
File "C:\Python34\lib\tkinter\__init__.py", line 1270, in configure
return self._configure('configure', cnf, kw)
File "C:\Python34\lib\tkinter\__init__.py", line 1261, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-bg"
I had Googled how to do the changing of colors when hovering and found the following code. Though for some reason, it does not work for me. What am I doing wrong?
achievementsButton.bind("<Enter>", lambda event: achievementsButton.configure(bg = "red"))
achievementsButton.bind("<Leave>", lambda event: achievementsButton.configure(bg = "white"))
This is the code from where I originally defined achievementsButton.
achievementsButton = ttk.Button(self, text = "Achievements", command = lambda: controller.show_frame(achievements), width = "25")