When using matplotlib interface, buttons and all are not controlled by us directly, they go through the event loop that matplotlib controls. I am not clear on how to call a function while the loop is operating, which means when clcking "Save" it sometimes locks because of the automatic update that is running in the background. If I controlled the event loop, I would create a separate thread to get the spectrometer data and create an event to refresh the graph each time there is new data, but I am not sure how to do that.