Python Plugin¶
Overview¶
The Python plugin (PythonPlugin) is a plugin that makes the Python programming language available on Choreonoid.
The C++ libraries of Choreonoid have Python bindings, and by importing modules such as cnoid.Base and cnoid.Body from Python, you can write operations on project items and various processes using body models in Python. This plugin provides the following functions for executing such Python scripts on Choreonoid.
Python script item (PythonScriptItem)
An item corresponding to Python script files (.py). It allows you to manage scripts as project items and execute them with GUI operations.
Python console view (PythonConsoleView)
A console for interactively executing Python on Choreonoid.
As a related plugin, the PythonSimScript plugin (PythonSimScriptPlugin) is also built together. It provides the Python simulation script (PythonSimScript item) that is executed in conjunction with simulations, which allows scripts to be executed at timings such as the start of a simulation.
For the details of how to use these functions, refer to the chapter Python Scripting.
How to Build¶
The Python support corresponds to the CMake option ENABLE_PYTHON, which is ON by default on Ubuntu. Python itself (including the development libraries) and NumPy are required for the build.
For how to build on Windows, refer to the Python plugin section in Building Optional Features of Building and Installing from Source Code (Windows).