How do i turn off the button "glowing" on python tkinter (Linux)?

Viewed 30

So, i've been learning a bit of tkinter and i've just found out that some things like buttons work differently from windows to linux... On windows everything works fine but on linux, when i over the button (with an image) it glows and, honestly, i can't figure out how to fix this.

from tkinter import *
import tkinter as tk
import PySimpleGUI as sg

root = tk.Tk()
root.title("Test")
root.geometry("500x500")    

close_icon = PhotoImage(file='assets/Close Button.png')
close_button = tk.Button(root, image=close_icon, command=root.destroy, borderwidth=0)
close_button.pack()

if __name__ == "__main__":
    root.mainloop()

What it should always look like:

What it should always look like

What it looks like when i hover it:

What it looks like when i hover it

1 Answers

Try to set option activebackground to be the same background color of the window.

color = root.cget("background")
close_button.configure(activebackground=color)
Related