简体   繁体   English

Python [画布]:未按下检测鼠标按钮

[英]Python [Canvas]: Detect Mouse Button NOT pressed

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(). 今天我的问题是,我想知道,是否有一种方法可以检测未使用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 :/ 随时在评论中提问:/

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM