Py5MouseEvent.get_x()

Py5MouseEvent.get_x()

Return the x position of the mouse at the time of this mouse event.

Examples

 1def setup():
 2    py5.size(200, 200, py5.P2D)
 3    py5.rect_mode(py5.CENTER)
 4
 5
 6def draw():
 7    py5.square(py5.random(py5.width), py5.random(py5.height), 10)
 8
 9
10def mouse_clicked(e):
11    py5.println(e.get_x(), e.get_y())

Description

Return the x position of the mouse at the time of this mouse event. This information can also be obtained with mouse_x.

Underlying Processing method: getX

Syntax

get_x() -> int

Updated on April 27, 2022 10:44:51am UTC