[英]How remove the gray background from my .png image
I'm using the pysimplegui to create my window, but inside that my image even being.png take the gray background.我正在使用 pysimplegui 创建我的 window,但在其中我的图像甚至 being.png 采用灰色背景。
thats my.png image:这就是我的.png 图像:
with "background color = blue"带有“背景颜色=蓝色”
import PySimpleGUI as sg
icon = sg.Image("./images/plane.png")
start_column = [
[icon]
]
layout = [
[start_column]
]
startWindow = sg.Window("hello", layout, background_color="blue")
while True:
events, values = startWindow.read(timeout=30)
if events == sg.WINDOW_CLOSED:
break
without "background-color = "blue" "没有“背景色=”蓝色“”
There're two background_color, one for sg.Image
and another one for sg.Window
.有两种 background_color,一种用于
sg.Image
,另一种用于sg.Window
。 background_color of sg.Image
will be sg.theme_background_color()
if you don't specify the option background_color
.如果您不指定选项
background_color
, sg.Image
的 background_color 将为sg.theme_background_color()
。
The background color will be '#64778d'
if you also don't specify what theme to use.如果您也没有指定要使用的主题,背景颜色将为
'#64778d'
。 So you will see background of your PNG will be different as background of window.所以你会看到你的PNG背景与window的背景不同。
You may specify same value of background_color for both of sg.Image
and sg.Window
, or all None
for them.您可以为
sg.Image
和sg.Window
指定相同的 background_color 值,或者全部为None
。
import PySimpleGUI as sg
layout = [[sg.Image("d:/plane.png", background_color="blue")]]
window = sg.Window("hello", layout, background_color="blue")
print(sg.theme_background_color())
while True:
event, value = window.read(timeout=30)
if event == sg.WINDOW_CLOSED:
break
window.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.