I'd like to make a drag-n-drop function for a widget. The code is this:
from tkinter import *
root = Tk()
root.config(background = "red", width = 500, height = 500)
root.title("root")
def frameDrag(event):
frame.place(x = event.x , y = event.y)
frame = Frame(root, width = 60, height = 30)
frame.place(x=0, y=0)
frame.bind("<B1-Motion>", frameDrag)
root.mainloop()
Basically, it should place the widget to the location you move your mouse to. Instead, the widget jumps around all over the window. Any ideas how to fix this?