Search code examples
pythontkintertkinter-button

Tkinter: Remove active button highlight


How can I remove the dotted black border after a button is clicked in Tkinter (with Ttkthemes)? enter image description here

I'm on Windows 10, Python 3.7.9.

There seems to be no uniform way to remove it and I searched across Google and SO with no luck. Thanks. Here's a minimal example:

import tkinter
import tkinter.ttk
from ttkthemes import ThemedTk

tk = ThemedTk(theme="arc")
tk.configure(background="#f5f6f7")
tk.resizable(0,0)

selectFileInput = tkinter.ttk.Button(
    tk,
    text="Select Input File"
)
selectFileInput.place(x=20,y=60)
tk.mainloop()

Solution

  • I found the solution. It was to create a dummy button and focus it to remove focus from the button to the dummy button by using dummy.focus()