Introduction

With Release 3.8 the Scout SDK offers support to integrate external JAR files into a Scout application with a few clicks. In this tutorial we use this capability to demonstrate how Jython may be integrated in your Scout application.

According to the Wiki"Jython is a Java implementation of Python" and Python itself claims "You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs." In any case, we need an example library here and combining Java with a powerful scripting language can help to solve a significant variety of problems.

The result at the end of this tutorial will look similar to the screenshot below:

Building the Jythonlib.jar

For this example we need the jython.jar library extended with the set of the Python standard modules typically provided in the Lib folder. After downloading jython from the official download page and installing it to some arbitrary directory you should find therer the following to items:

jython.jar

Lib

Now, we are ready to build our jythonlib.jar according to the description provided in the jython Wiki (in case the description moves to some other location it is repeated below):

To build our jar, we first make a copy of jython.jar, then add the
contents of the Lib/ directory (eg Lib/re.py) to it::

Create New Scout Project and add the Library bundle

Once the application model is shown in the Scout Explorer we can add the library bundle. To keep things as simple as possible this example we directly use the jython library in the client application. For this, select folder libraries below the orange client node in the Scout explorer. Then, right-click on context menu New Library Bundle ...

Blah

Add and Configure the Form Fields on the Desktop Form

bla

Add Logic for Jython Interpreter and Interaction with Scout Form

In the Scout Explorer select the RunButton element of the DesktopForm

In the Scout Object Properties click on the green plus-icon next to the link Exec Click Action to add the corresponding method