is it possible to return a mouses x and y position in python?
This using @mat1 xterm module:
import xterm printing = False def getclicks(): for char in xterm.readchrs(): if type(char)!=str: x = char.x y = char.y yield (x, y, char)
import clicks coords = clicks.getclicks()
There may be a few edits from the original because I have modified it to suit me.
The module yields only within the terminal and the top left of the terminal is (0, 0)
Please upvote if this was useful thanks!