python tkinter basic tools part2

Dreamescoding
Jan 23, 2021

Adding jpeg in button

TYPE this at upper

PIL import Image,ImageTk — this import jpeg format allow

Type This code-photo = PhotoImage(file=”hu.png”) — photo is name of it like a variable PhotoImage is function(file=”your full file name”)

mango = ImageTk.PhotoImage(photo) — mango is name of variable ImageTK.PhotoImage is function to allow jpeg(your photo image variable)

make a button -btn=Button(root,image=mango).pack() — Button is function (where you want to place,image=your ImageTK variable)

Full use of .pack()

For more visit our website https://dreamescoding.blogspot.com/?m=1

--

--