Hi Team
I am brand new at PySimpleGUI and have developed a user interface without functionality, what I am stuck on is making the ‘Calculation’ button work, and show result in the ‘Summary of Registration’ frame. Any help would be greatly appreciated, as I am going round in circles. It could be all wrong of course!!
code here:
‘’'import PySimpleGUI as sg
col1 = sg.Column(
layout=[
[sg.Frame(‘Customer Details’,[
[sg.Text(‘First Name:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Last Name:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Address:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Mobile Number:’), sg.Push(), sg.InputText(),],
],
size=(512, 130))
]
]
)
col2 = sg.Column(
layout=[
[sg.Frame(‘Membership Plan Type’,[
[sg.Combo(values=[‘Basic Plan ($10 pw)’, ‘Regular Plan ($15 pw)’, ‘Premium Plan ($20 pw)’], size=(69, 6))],
])] ])
col3 = sg.Column([
[sg.Frame(‘Membership Plan Duration’,[
[sg.Combo(values=[‘3 Months)’, ‘12 Months($2 p/w discount)’, ‘24 Months($5 p/w discount)’], size=(69, 6))],
])] ])
col4 = [
[sg.Text(‘Payment options’)],
[
sg.Frame(
layout=[
[
sg.Radio(‘Pay by direct debit’, “PAYMENT”, default=True),
sg.Radio(‘Pay by other means’, “PAYMENT”),
],
[
sg.Radio(‘Weekly’, “FREQUENCY”),
sg.Radio(‘Monthly’, “FREQUENCY”, default=True),
],
],
title=‘Please CHECK the boxes that apply to you’,
title_color=‘white’,
size=(520, 80)
)
],
],
col5 = [sg.Frame(‘Extra Gym Services’,[
[sg.Checkbox(‘24 hour/7 days access ($1 pw)’, size=(25,1)), sg.Checkbox(‘Personal Trainer ($20 p/w)’, size=(25,1))],
[sg.Checkbox(‘Diet Consultation ($20 p/w)’, size=(25,1)), sg.Checkbox(‘Access online Fitness classes ($2 p/w)’, size=(30,1))],
])],
col6 = sg.Column(
layout=[
[sg.Frame(‘SUMMARY OF REGISTRATION: STAFF ONLY’,[
[sg.Text(‘Membership Cost Total:’), sg.Push(), sg.InputText(),],
[sg.Text(‘EXTRA added:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Total Discount:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Net membership cost:’), sg.Push(), sg.InputText(),],
[sg.Text(‘Regular payment amount:’), sg.Push(), sg.InputText(),],
],
size=(512, 130))
]
]
)
col7 = sg.Column([
[sg.Text(‘Please finalise your selection, by clicking the button below’)],
[sg.Button(‘Calculate’),sg.Button(‘Submit’),sg.Button(‘Clear’),sg.Button(‘Exit’, button_type=“quit”)],
])
Define the layout for the form
layout = [[col1],[col2],[col3], [col4], [col5], [col6], [col7]]
Create the form
form = sg.FlexForm(‘City Gym Main Screen’, layout, size=(550, 670))
Loop indefinitely to allow the user to enter multiple sets of data
while True:
# Show the form and get the input
button, data = form.read()
# If the Clear button is clicked, clear the form
if button == ‘Clear’:
form.update()
# If the Exit button is clicked, exit the loop
elif button == ‘Exit’ or button == sg.WIN_CLOSED:
break
Close the form
form.close()