Py5 Tools#

The py5 Tools are extra utility functions not directly related to creating Sketches that help faciliate the use of py5.

Examples#

1import py5_tools
2
3print(py5_tools.get_jvm_debug_info())
1import py5_tools
2
3py5_tools.add_jars('path/to/project_jars')
4py5_tools.add_classpath('path/to/jar/file/java_code.jar')
5
6import py5
7
8py5.println(py5_tools.get_classpath())

Description#

The py5 Tools are extra utility functions not directly related to creating Sketches that help faciliate the use of py5. For example, you can use these to add jar files to the Java classpath before importing py5. All of the py5 Tools are in the Python package py5_tools, which are installed alongside py5 but must be explicitly imported before using them. The py5_tools package is imported for you when coding in imported mode such as with the py5 Jupyter Notebook kernel.

The following functions are provided:

  • add_classpath(): Add a Java jar file to the classpath.

  • add_jars(): Add all of the Java jar files contained in a directory and its subdirectories to the classpath.

  • add_options(): Provide JVM options to use when the JVM starts.

  • animated_gif(): Create an animated GIF using a running Sketch.

  • capture_frames(): Capture frames from a running Sketch.

  • get_classpath(): Get the Java classpath.

  • get_jvm_debug_info(): Get Java Virtual Machine debug information.

  • is_jvm_running(): Determine if the Java Virtual Machine (JVM) is or is not running.

  • offline_frame_processing(): Process Sketch frames in a separate thread that will minimize the performance impact on the Sketch’s main animation thread.

  • save_frames(): Save a running Sketch’s frames to a directory.

  • screenshot(): Take a screenshot of a running Sketch.

  • sketch_portal(): Creates a portal widget to continuously stream frames from a running Sketch into a Jupyter notebook.

Updated on September 16, 2021 14:31:43pm UTC