ich wollte zum einstieg ein tkinter ein bild ueber den bildschirm ziehen, allerdings wird bei jeder 2. bewegung ein falsches koordinatenpaar gesendet.
also z.b. so :
in motion :22
in motion :1
in motion :23
in motion :1
das bild entfernt sich somit immer weiter von der tatsaechlichen mouseposition. was mach ich falsch?
Code: Alles auswählen
from tkinter import *
class Board(Tk):
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
self.bild=PhotoImage(file="letter_a.gif")
self.label=Label(image=self.bild)
self.label.place(x=0,y=0)
self.label.bind('<B1-Motion>',self.b1motion)
def b1motion(self,event):
print("in motion :"+str(event.x))
event.widget.place(x=event.x,y=event.y)
board=Board()
board.mainloop()