Home > Blockchain >  Image background black
Image background black

Time:10-12

So even though I tried to set the background to custom color the picture is automatically set with bg=black. Witch I am guessing is default. Can someone tell me in what moment I have to set the background, and how to do it so the picture doesn't get automatically filled with black.


window = Tk()
window.title('Random Password Generator')
window.geometry('400x250')
window.config(bg=GREEN)

#openImage
pic = Image.open('lock.png')
#resized
resized = pic.resize((100,150), resample=1)
new_pic = ImageTk.PhotoImage(resized)
#enter image
image = Label(image=new_pic)
image.config(compound='bottom', anchor='e')
image.grid(column=0, row=0, padx=10)

This is the result at the moment This is how it looks in the program (imagine the gray is a white and gray chess board)

  1. why is the picture still bg='black' even though I set it to GREEN

CodePudding user response:

This image is filled with black even if its not on a black background. You should try to set a white bg or just pick an image witch is filled in white

CodePudding user response:

According to enter image description here

Tkinter output window:
enter image description here

  • Related