...
The Python Tutorial for Geosoft GX Developer provides an overview of Python with lessons that demonstrate how to create extensions (see Hello World#DesktopExtension), and how to add an extension to a menu (see Creating a Menu to Run Python Extensions).
See also Python Stand-Alone that describes how to run Python scripts directly from the Python interpreter.