image gui tkinter code example
Example 1: python tkinter image
import tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
img = Image.open("path\\to\\imgage.jpg")
img = img.resize((250, 250))
tkimage = ImageTk.PhotoImage(img)
tk.Label(root, image=tkimage).grid()
Example 2: image tkinter
from tkinter import *
root = Tk()
canvas = Canvas(root, width = 300, height = 300)
canvas.pack()
img = PhotoImage(file="ball.ppm")
canvas.create_image(20,20, anchor=NW, image=img)
mainloop()