GUIS reformΒΆ

# -*-Python-*-
# Created by bgrierson at 20 Dec 2016  13:19

# This demo creates a GUI that reforms based on the user-selected ComboBox

# Create the main GUI
OMFITx.TitleGUI('Basic Reforming GUI Demo')

# Create a combobox with options that map to variables
opts = SortedDict(list(zip(['Option #1', 'Option #2'], ['opt1', 'opt2'])))
OMFITx.ComboBox("scratch['combobox_reform']", opts, 'OMFITx.Combobox', default='opt1', updateGUI=True)
if scratch['combobox_reform'] == 'opt1':
    printi('Selecting option {}'.format(scratch['combobox_reform']))
    printi('Saving entry to scratch variable entry_reform1')
    # Create a text entry
    OMFITx.Entry("scratch['entry_reform1']", "OMFITx.Entry for #1", default=1.0, help='A live text entry')
if scratch['combobox_reform'] == 'opt2':
    printi('Selecting option {}'.format(scratch['combobox_reform']))
    printi('Saving entry to scratch variable entry_reform2')
    # Create a text entry
    OMFITx.Entry("scratch['entry_reform2']", "OMFITx.Entry for #2", default=2.0, help='Another live text entry')