Py5Surface.get_native()

Get the Sketch’s Java native window object.

Examples

1
2
3
4
5
py5.run_sketch(block=False)
surface = py5.get_surface()
native = surface.get_native()
# output will depend on your operating system and the sketch's renderer
py5.println(type(native))

Description

Get the Sketch’s Java native window object. Here there be dragons! The returned object will be a Java object you can interact with through py5’s Python-Java bridge, jpype. The type of the native window will depend on your operating system and the Sketch’s renderer, and is subject to change in future releases of Processing.

This method may be useful to you if you research the Java libraries Processing uses to display animations. Any errors will result in Java Exceptions.

Underlying Java method: PSurface.getNative

Syntax

get_native() -> Any

Updated on September 11, 2021 16:51:34pm UTC