Tkinter | SoloLearn: Learn to code for FREE!

+1

Tkinter

How to insert image in tkinter form

7/1/2020 11:49:58 AM

Shree suhani

3 Answers

New Answer

+11

Shree suhani I have found some threads for you. Please try to use the search bar🔎 next time. For search bar https://www.sololearn.com/post/10362/?ref=app https://www.sololearn.com/Discuss/1918770/?ref=app https://www.sololearn.com/Discuss/1283036/?ref=app https://www.sololearn.com/Discuss/2079506/?ref=app

+7

this will help you https://www.google.com/amp/s/www.geeksforgeeks.org/python-add-image-on-a-tkinter-button/amp/ from tkinter import *  from tkinter.ttk import * # creating tkinter window root = Tk() # Adding widgets to the root window Label(root, text = 'Root', font =(   'Verdana', 15)).pack(side = TOP, pady = 10) # Creating a photoimage object to use image photo = PhotoImage(file = r"C:\Gfg\circle.png") # here, image option is used to # set image on button Button(root, text = 'Click Me !', image = photo).pack(side = TOP)    mainloop()

+5

You need to use pillow module Which is made for handling image task have a demo look \/ from tkinter import * from PIL import ImageTk,Image. root = Tk() canvas = Canvas(root, width = 300, height = 300) canvas.pack() img = ImageTk.PhotoImage(Image.open("ball.png")) canvas.create_image(20, 20, anchor=NW, image=img) root.mainloop()