Python [Canvas]: Detect Mouse Button NOT pressed

142 Views Asked by At

My question today is, that I'd like to know, if there's a way to detect a mouse button NOT pressed using canvas.bind(). I want to know that, because I want to save data while a button is pressed, and to stop saving data when the button is not pressed anymore. I want to do this with the left mouse button / ''

If you don't know what I wan't to do; feel free to ask in the comments :/

1

There are 1 best solutions below

0
Kevin On

Detect mouse press and release events. When one of those events occur, start or stop saving as appropriate.

canvas.bind("<Button-1>", start_saving)
canvas.bind("<ButtonRelease-1>", stop_saving)