I have two radio buttons. When the .csv button is selected, I want there to only be one input box. when .rsp is selected, I have a new input box appear. It creates space to fit between the radio buttons and the create button. When it disappears, the space remains. Is there a way to get rid of this space when the element is hidden?
import PySimpleGUI as sg
# Define a custom theme for the GUI
my_new_theme = {'BACKGROUND': "#31363b",
'TEXT': "#f9f1ee",
'INPUT': "#232629",
'TEXT_INPUT': "#f9f1ee",
'SCROLL': "#333a41",
'BUTTON': ('#31363b', '#0dd1fc'),
'PROGRESS': ('#f9f1ee', '#31363b'),
'BORDER': 1,
'SLIDER_DEPTH': 0,
'PROGRESS_DEPTH': 0}
# Add and set the custom theme
sg.theme_add_new("MyNewTheme", my_new_theme)
sg.theme("MyNewTheme")
sg.set_options(font=("Helvetica", 12))
layout = [
[sg.Text("Input mesh name:", pad=(1, 5)), sg.InputText(key="mesh")],
[sg.Text("Paste boundary conditions below:", pad=(1, 5))],
[sg.Multiline(key="bound_cond", size=(35, 10), pad=(1, 5))],
[sg.Radio(".csv", "RADIO1", default=True, key='-CSV-', enable_events=True, pad=(1, 5)),
sg.Radio(".rsp", "RADIO1", key='-RSP-', enable_events=True, pad=(1, 5))],
[sg.Text("Select .csv or .rsp file:", size=(17, 1)), sg.Input(), sg.FileBrowse("Choose")],
[sg.Column([[sg.Text("Auto-assign:", size=(17, 1)), sg.Input(key='-FILE-'),
sg.FileBrowse("Choose")]], key='-NODE_FILE-', visible=False, pad=(0, 0))],
[sg.Button("Create")]
]
window = sg.Window("Input Creation Wizard", layout=layout)
while True:
event, values = window.read()
match event:
case sg.WIN_CLOSED:
break
case '-RSP-':
window['-NODE_FILE-'].update(visible=True)
case '-CSV-':
window['-NODE_FILE-'].update(visible=False)
window.close()
1