apology for bad english
So I was doing a program and want the label created in class to move by dragging it with mouse but whatever I try to do it doesnt work and doesnt want to move this is my code:
class Note:
def __init__(self,master):
myFrame = Frame(master)
myFrame.place(x=50,y=50)
self.myLabel = Label(myFrame, text="Text",font=("Arial",20))
self.myLabel.pack()
self.myFrame = myFrame
self.myFrame.bind("<Button-1>",self.drag_start)
self.myFrame.bind("<B1-Motion>",self.drag_motion)
def drag_start(self,event):
widget = event.widget
widget.startX = event.x
widget.startY = event.y
def drag_motion(self,event):
widget = event.widget
x = widget.winfo_x() - widget.startX + event.x
y = widget.winfo_y() - widget.startY + event.y
widget.place(x=x,y=y)
e = Note(root)
what can I do to make it start moving when dragging by mouse?