Periodic Element Example
Location: examples/rappture2/periodicelement/
This example demonstrates the <periodicelement> input type – an
interactive periodic table picker.
tool.xml
<?xml version="1.0"?>
<run xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../rappture2web/contract.xsd">
<tool>
<title>periodicelement (rappture2web)</title>
<about>Example of a Rappture <periodicelement> object.
Periodic element selectors allow users to pick elements from the periodic table.
</about>
<command>python3 @tool/periodicelement.py @driver</command>
<contract>
<input>
<periodicelement id="first">
<about>
<label>First Element</label>
<description>Select the first element.</description>
</about>
<default>As</default>
<returnvalue>name</returnvalue>
</periodicelement>
<periodicelement id="second">
<about>
<label>Second Element</label>
<description>Select the second element.</description>
</about>
<default>Oxygen</default>
<returnvalue>name symbol number weight</returnvalue>
</periodicelement>
<periodicelement id="third">
<about>
<label>Third Element</label>
<description>Select the third element.</description>
</about>
<default>Carbon</default>
<returnvalue>weight</returnvalue>
<active>other-non-metal</active>
</periodicelement>
</input>
<output>
<string id="out"><about><label>Selected elements</label><description>Reports the selected periodic table elements.</description></about></string>
</output>
</contract>
</tool>
<input>
<periodicelement id="first">
<about>
<label>First Element</label>
<description>Select the first element.</description>
</about>
<default>As</default>
<returnvalue>name</returnvalue>
</periodicelement>
<periodicelement id="second">
<about>
<label>Second Element</label>
<description>Select the second element.</description>
</about>
<default>Oxygen</default>
<returnvalue>name symbol number weight</returnvalue>
</periodicelement>
<periodicelement id="third">
<about>
<label>Third Element</label>
<description>Select the third element.</description>
</about>
<default>Carbon</default>
<returnvalue>weight</returnvalue>
<active>other-non-metal</active>
</periodicelement>
</input>
</run>
Key concepts
<returnvalue>controls what data the script receives:name,symbol,number,weight, or any combination.<active>restricts which element categories can be selected (e.g.,other-non-metal).Default can be an element symbol (
As) or full name (Oxygen).
Running
rappture2web examples/rappture2/periodicelement/