JMRI is...


Information on writing scripts to control JMRI in more detail:


JMRI scripts are in Python, a popular general-purpose computer language


JMRI provides powerful tools for working with your layout.

Layout Automation

JMRI can be used to automate parts of your layout, from simply controlling a crossing gate to running trains in the background.

JMRI: Jynstruments

JMRI provides a nice way to integrate Jython scripts in the JMRI Java application, particularly aimed at extending and customising the GUI.

That is called a Jynstrument. It's a bundle of Jython code and other resources. The Jython code defines an object deriving from the Java Jynstrument class (itself deriving from JPanel). This object will be instantiated by the instrumented JMRI code itself and then is event driven.

Fully Jysntrumented Throttle Window Have a look at the Jython folder in your source tree, there is Jynstruments folder with a README and a ThrottleFrame/Light.jyn to be tried on the JMRI Throttle window. The image to the right shows them in use (the diamond buttons).
In the Jython folder, you'll also find a simple Test.jyn for testing purpose.

See for how to make code instrumentable; more details are in the README.

Usage is quite simple, drag'n drop the Light.jyn folder onto a JMRI Throttle Window (on window content itself, the toolbar is instrumentable too, but won't accept the Lights.jyn).

Once the Jynstrument is started, the GUI will update, a Jynstrument property menu is accesible by right clicking on the Jynstrument or its border. From this menu you can Remove the Jynstrument, or view its Ouput.


See the content of the Jynstrument itself (comments in the .py file) for specific informations about them.

Several parts of JMRI are Jynstrumentable today: