TKinter leaving borders around widgets

后端 未结 2 1585
迷失自我
迷失自我 2020-12-11 13:23

When I put a button in on a colored background TKinter leaves this weird white box around the widget. For example the code below:

from Tkinter import *

root         


        
相关标签:
2条回答
  • This problem has been plaguing Macs for years. But as of Python 3.7 it's safe-ish to install from Python.org instead of Homebrew. This problem disappears when Python is installed from Python.org instead of running the Homebrew version.

    0 讨论(0)
  • 2020-12-11 13:42

    The extra border is caused by the highlightthickness attribute. The default value is 1 (one); set it to zero to remove the border. This border shows when the button has keyboard focus.

    However, it appears you're running this on OSX. OSX buttons are a bit less configurable than on other platforms. Setting highlightthickness to zero won't help. The best you can do is set highlightbackground to the same color as your background so that it blends in.

    0 讨论(0)
提交回复
热议问题