+ 1

Tkinter

How to insert image in tkinter form

1st Jul 2020, 11:49 AM
Shree suhani
Shree suhani - avatar
3 Respostas
+ 7
this will help you https://www.google.com/amp/s/www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-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()
1st Jul 2020, 12:12 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 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()
1st Jul 2020, 11:54 AM
Ayush Kumar
Ayush Kumar - avatar