I'm using EPD traits for a basic GUI interface. I'm able to pop up a settings window using code like this:
settings_w.configure_traits(kind="livemodal")
The window has 'OK' and 'Cancel' buttons and I want to do something different depending on which button was pressed to exit the window. Seems like it should be simple but I can't figure out how to set this up.
Theoretically I'd like to do something like this:
# Display the settings widget
settings_w.configure_traits(kind="livemodal")
if settings_w.CancelButtonPressed:
pass
else:
print "I got the input"
But let me know if there's a better or more correct way to do this.
Also FWIW: here's the view properties of my settings window with standard OK and Cancel buttons:
view = View(
settings_group,
title = 'Settings Editor',
width = 500,
buttons = [OKButton, CancelButton, 'Help' ],
kind = 'modal',
handler = SaveRestore_Handler()
)