Py5 Tools#
The py5 Tools are extra utility functions not directly related to creating Sketches that help faciliate the use of py5.
Examples#
import py5_tools
print(py5_tools.get_jvm_debug_info())
import py5_tools
py5_tools.add_jars('path/to/project_jars')
py5_tools.add_classpath('path/to/jar/file/java_code.jar')
import py5
py5.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.
live_coding.activate(): Start Live Coding from a Jupyter Notebook.
live_coding.copy_code(): Create a backup copy of the current code.
live_coding.count(): Return the number of times the live code has been updated.
live_coding.screenshot(): Create a screenshot of the current Sketch window.
live_coding.snapshot(): Create a screenshot of the current Sketch window and a backup copy of the current code.
offline_frame_processing(): Process Sketch frames in a separate thread that will minimize the performance impact on the Sketch’s main animation thread.
register_processing_mode_key(): Register a callable or module when programming in py5’s Processing Mode.
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 March 18, 2024 05:08:14am UTC