Drag and Drop Images in Python (NEED HELP!)

lucas mvm lucasvfxdood at gmail.com
Fri Jan 2 01:36:19 CET 2015

Hi at all user!

I used Tkinter and canvas to make a window and i added 2 transparent .png images. So when i start my programm it just shows the 2 images.
I want to drag one image above the other image and than it will disappear.
So I need help with "drag and drop images"

heres my code if you want to have a look, its basically just displaying 2 images but i want to drag 1 image above the other one..

#pythonprogramm "feed"
from tkinter import * #importing tkinter
f = Tk()
f.title('Give the boy his apple.')
c = Canvas(master=f,width=500,height=500,bg='white')
p = PhotoImage(file='sadsmiley.png') #sad smiley image
i = c.create_image(250,320,image=p) #genaue position
p2 = PhotoImage(file='food.png') #food image (should be dropped on sadsmiley)
i2 = c.create_image(70,100,image=p2)

More information about the Python-list mailing list