如何删除Tkinter按钮和框架上的边框?

I am currently building a simple app to encrypt files using AES encryption in python but the biggest downside of using Tkinter is the look of the UI. I did some research and found examples of what I want but do not know how to recreate it. (Example)

My problem is that when I replace buttons with images (like the OP of the Reddit post said he did in order to have a decent looking UI) I end up with an ugly bar of grey. (Image of the button)

我也想删除带有框架的相同类型的栏,因此,如果您有明确的答案,仍将不胜感激。

评论
类敏思
类敏思

Since Tk8.6 tkinter has support for styles and themes. A theme being a collection of styles for different widgets.

You can read more about style and themes here.

就我所知,标准小部件不支持圆角。所有小部件都具有矩形形状。

You might be able to create something like that using a Canvas, but it would be a significant amount of work. A more relevant point is that it might confuse your users if you don't reproduce the way the standard controls work.

出于与汽车中的控件相同的原因,UI元素被标准化。一旦您知道其中之一,就可以全部使用。

点赞
评论
iullam
iullam

原来答案隐藏在Google的第5页中。所以回答我自己的问题感觉很奇怪。 bg属性控制边框的粗细,因此将其设置为0会删除所有边框。

例:

button = Button(root, text='Example', bd=0)

现在我们没有边界了,我的按钮看起来不错。

点赞
评论