隐藏tkinter文本小部件边框

问题描述 投票:0回答:2

我正在使用Python 3.7和tkinter Text小部件构建文本编辑器。我想要一个平面显示器,并隐藏文本小部件周围的边框(甚至没有焦点边框)。文本小部件使​​用db=0配置初始化。但是-我正在Windows 10机器上按预期方式工作,但在Linux(Ubunto 19.04)上仍然显示边框。有没有办法在Linux上隐藏黑色边框?

这是设置小部件的方式:

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)

这是Ubunto的外观(我在黄色背景上突出显示了边框):

enter image description here

这是相同代码在Windows 10上的工作方式(这也是我希望在Linux 10上显示的方式:

enter image description here

python user-interface tkinter
2个回答
0
投票

您所指的不是边界本身。它称为突出显示环,用于让用户知道文本小部件具有焦点。

如果要删除它,请将highlightthickness设置为零。


0
投票
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)

如果未解决,请尝试执行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)
© www.soinside.com 2019 - 2024. All rights reserved.