Найти - Пользователи
Полная версия: Tkinter как работает move
Начало » Python для новичков » Tkinter как работает move
1
3dpython
Изучаю tkinter кружок почему то не перемещается непрерывно когда я зажимаю на нем мышкой.
Как подправить код что бы кружок стал перемещаться если зажать на нем лкм.
from tkinter import*
c = Canvas(width=500,height=500,bg='grey80')
c.pack()
lastx=50
lasty=50
oval = c.create_oval(0,0,100,100,fill="orange")
def mouseMove(event):
    global lastx,lasty
    c.move(CURRENT, event.x-lastx , event.y-lasty )
    lastx = event.x
    lasty = event.y
    print(lastx,lasty)
    return lastx,lasty
c.tag_bind(oval,'<Button-1>',mouseMove)
mainloop()
sp3
Событие то не правильное: <Button-1> -> <B1-Motion>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB