I’m trying to get the value of a check box in a flexform. I thought I might be having issues with it because I’m closing the form in a function that is called by a button so I tried adding it to the functions but that is not working either. Every time it returns None.
accepted = False
invertStatus = False
def acceptPressed(sender, args):
global accepted
global invertStatus
accepted = True
invertStatus = form.values.get("Invert")
form.close()
def cancelPressed(sender, args):
global accepted
global invertStatus
accepted = False
invertStatus = form.values.get("Invert")
form.close()
components = [Label("Invert, Accept, or Cancel"),
CheckBox("Invert", "Invert"),
Button("Accept", on_click=acceptPressed),
Button("Cancel", on_click=cancelPressed)
]
form = FlexForm("Confirm Change", components)
form.show()
print(form.values.get("Invert"))
print("Is accepted?")
print(accepted)
print("Is Inverted?")
print(invertStatus)