I'm trying to create a persistent input form that let's a user input some data and hit submit, which then causes another popup telling the user if the data was successfully submitted. I've gotten it to work in a non-persistent way so that the input form is re-created each time, but I've been having problems trying to leave the input form open using a ReadFormButton.
import PySimpleGUI as sgui
form = sgui.FlexForm('Legacy Data Entry Application v10.42.exe', auto_size_text =True)
layout = [
[sgui.Text('Please enter data in fields below', font = ('Helvetica', 20), justification = 'center')],
[sgui.Text('Record ID', size = (16,1)), sgui.InputText(key = 'id'), sgui.Text('Record Type', size = (16,1)),
sgui.InputCombo(('Sale','Subscription', 'Late Fee'), size= (24,1), key = 'record_type')],
[sgui.Text('Receipt Date', size = (16,1)), sgui.InputText('MM/DD/YYYY', key = 'receipt_date'),
sgui.Text('Amount', size = (16,1)), sgui.InputText(key='amount')],
[sgui.Text('Today\'s Date', size = (16,1)), sgui.InputText('MM/DD/YYYY', key='today_date')],
[sgui.Text('Customer Name', size = (16,1)), sgui.InputText( key='name')],
[sgui.Text('Address 1', size = (16,1)), sgui.InputText( key= 'add1')],
[sgui.Text('Address 2', size = (16,1)), sgui.InputText( key= 'add2')],
[sgui.Text('City', size = (16,1)), sgui.InputText(key='city')],
[sgui.Text('State', size = (16,1)), sgui.InputText(key = 'state')],
[sgui.Text('ZIP', size = (16,1)), sgui.InputText(key = 'zip')],
#[sgui.Submit(), sgui.Cancel()]
[sgui.ReadFormButton('Submit', bind_return_key = True), sgui.Cancel()]
]
Then I Read() from the form and if "Submit" was clicked I try to open a new form:
sgui.MsgBox('Record successfully submitted', auto_close = True, auto_close_duration = 2)
But what I get is a window with no text line, just the OK button. But if I replace the ReadFormButton above on the input form with the commented out line, so that it uses a regular submit button, then form2 displays properly.
Looking through your documentation I haven't found an example that is perfectly comparable, so I might just be using ReadFormButtons wrong, but I thought that it could be a bug too.