Codes:
from tkinter import *
from PIL import ImageTk, Image
root=Tk()
#place image
path = "download (1).jpeg"
img = ImageTk.PhotoImage(Image.open(path))
panel = Label(root, image = img)
panel.image = img # keep a reference!
panel.pack(side = "top", fill = "both", expand = "yes")
def getorigin(img):
path = "download (2).jpeg"
img = ImageTk.PhotoImage(Image.open(path))
panel.configure(image=img)
panel.image = img # keep a reference!
#mouseclick event
panel.bind("<Button 1>",getorigin)
#Start the GUI
root.mainloop()
No comments:
Post a Comment