标签周围有图像的白色边框? [英] White border around Label with an image?

查看:93
本文介绍了标签周围有图像的白色边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一些图像放到tkinter小部件中,使用的是经典图像:

I put some image in a tkinter widget, with the classical:

logo=PhotoImage(file="C:\Users\name\Desktop\image.gif")
immglab1=Label(image=logo)
immglab1.image=logo
immglab1.pack(anchor=N)

问题是,当我将小部件背景颜色(#1A1A1A)设置为与图像背景颜色相同时,在image.gif周围出现白色边框,我不明白为什么.

The problem is that when I set the widget background color (#1A1A1A) same as image background color is appeared a white frame around the image.gif and I can't understand why.

一些建议?

推荐答案

白色框是图像边框和/或突出显示环.您需要将borderwidthhighlightthickness属性设置为零:

The white frame is the image border and/or highlight ring. You need to set the borderwidth and highlightthickness attributes to zero:

immglab1=Label(image=logo, borderwidth=0, highlightthickness=0)

这篇关于标签周围有图像的白色边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆