In this tutorial we explain how to run BornAgain Python examples in a convenient manner using the
This is a community driven, lightweighted and open-source editor from Microsoft, which provides code highlighting for many languages and
can be extremely handy in any kind of script-related and code-related activity.
At this point we assume that the user has already installed BornAgain and a Python distribution as explained in Python installation section.
Download the editor from official website.
VSCode and you will find yourself on the welcome screen.
Add the folder with the BornAgain Python examples to the workspace
Add workspace folder as shown in the screenshot below.
Choose the directory with the BornAgain Python examples at
If you open any example,
VSCode will require you to configure the Python interpreter to use. In the screenshot below,
VSCode is complaining
that no Python interpreter was selected and also suggests to install the so-called
pylint plugin for a better code development experience.
Select Python Interpreter and select the interpreter you have installed previously. Install
On the screenshot below
VSCode is fully configured and ready for work.
Finally you can run an example using the right mouse button.
The script will be executed in a terminal embedded in
VSCode and a scattering image will appear on the screen after simulation has completed.
Now you can try to run other BornAgain Python examples and start your exciting journey in Python scripting with BornAgain!