MSE
MSE

Reputation: 685

Hide tkinter Text widget border

I'm building a text editor with Python 3.7 and tkinter Text widget. I would like to have a flat display and hide the borders around the text widget (not even focus border). The Text widget is initialized with db=0 config. However - I'm getting it work as expected on my Windows 10 machine but border is still showing on Linux (Ubunto 19.04). Is there a way to hide the black border on Linux?

This is how the widget is set:

self.editor_text = tk.Text(self.editor_frame, bd=0, bg="white", fg="black", font=(self.FONT_NAME, self.FONT_SIZE), undo=True, autoseparators=True, maxundo=-1)

This is how it looks on Ubunto (I highlighted the border in yellow background):

enter image description here

This is how the same code works on Windows 10 (which is how I'd like it to show on Linux as well):

enter image description here

Upvotes: 2

Views: 6641

Answers (2)

Nj Nafir
Nj Nafir

Reputation: 568

self.editor_text = tk.Text(self.editor_frame, bd=0, bg="white", fg="black", highlightthickness = 0, borderwidth=0, font=(self.FONT_NAME, self.FONT_SIZE), undo=True, autoseparators=True, maxundo=-1)

if it not solved try to do self.editor_text = tk.Text(self.editor_frame, bd=0, bg="white", fg="black", font=(self.FONT_NAME, self.FONT_SIZE), undo=True, autoseparators=True, maxundo=-1)

self.editor_text.config(highlightthickness = 0, borderwidth=0)

Upvotes: 3

Bryan Oakley
Bryan Oakley

Reputation: 385890

What you are referring to isn't a border per se. It's called a highlight ring and it is used to let the user know that the text widget has focus.

If you want to remove it, set highlightthickness to zero.

Upvotes: 1

Related Questions