Tuesday 5 January 2021

How to make a Picture button with tkinter

I wrote this code:

import tkinter as tk
from PIL import ImageTk, Image
window = tk.Tk()
window.geometry("960x540+480+200")
load = Image.open("example.png")
render = ImageTk.PhotoImage(load)
img = tk.Label(image=render)
img.image = render
img.place(x=450, y=280)
tk.mainloop()

How do I make it that if you press the picture like a button, something will happen?



from How to make a Picture button with tkinter

No comments:

Post a Comment