Py5MouseEvent.get_native()#
Retrieve native mouse event object.
Examples#
def setup():
py5.size(200, 200, py5.P2D)
py5.rect_mode(py5.CENTER)
def draw():
py5.square(py5.random(py5.width), py5.random(py5.height), 10)
def mouse_clicked(e):
native_event = e.get_native()
if native_event != None:
py5.println(native_event.getX(), native_event.getY())
Description#
Retrieve native mouse event object. The returned object will be a Java object and its type can vary based on the renderer used by the Sketch and the operating system the Sketch is run on. Sometimes the native object can be used to access functionality not otherwise available through Processing or py5.
Be aware that it is possible for the native event object to be None
, such as when interacting with a Sketch through py5_tools.sketch_portal().
Underlying Processing method: MouseEvent.getNative
Signatures#
get_native() -> Any
Updated on May 02, 2024 03:24:20am UTC