Getting the speed of mouse movement?

Is there a way, in Python, to get the speed of the mouse when it’s moving?

yes, you compare the current and previous mouse coords

velocity = distance / time

distance would be sqrt((curr.x-prev.x)**2-(curr.y-prev.y)**2)
where curr is the current coordinates of the mouse and prev is the previous.
on init, assign prev to curr but set prev at the end of the function.

then for time, you could us time.time() or a timer property or just some value.

That. Also, for FPS games, you would also usually reset the mouse position to the middle of the screen after getting the co-ordinates to stop the mouse from flying off the side.

at the bottom of the file is what i use for mouselooking. its much better then traditional recenter every frame.