Aditya S
Aditya S

Reputation: 35

Why does my image disappear in Tkinter Python After I Resize The Picture?

I have some simple code really. I am attempting to resize and display an image in Tkinter, but for some reason only after resizing the picture does it disappear. I am using Python 3.6 and Tkinter, and I am a beginner really. Here is the code. The file name is "Icon For To - Do List.png".

from tkinter import *
import datetime

root = Tk()
root.title("To - Do List")
root.geometry("1200x600")
root.configure(background = "white")
# Variable list:


Photo1= PhotoImage(file="Icon For To - Do List Yay.png", width=50, height=50)

Label(root, image=Photo1, bg="black").grid(row=0, column=0, sticky=W)
root.mainloop()

Here is the image. Its dimensions are 1000 x 994. Any help would be greatly appreciated. Thank You Very Much!

Upvotes: 0

Views: 358

Answers (1)

AD WAN
AD WAN

Reputation: 1474

You can use subsample to resize the image without the use another module

 BR = photo1.subsample(1, 2)

Then you parsed that to your image in the label. You can increase or decrease the integer to your prefer size

Upvotes: 1

Related Questions