Skip to content

Instantly share code, notes, and snippets.

View djwbrown's full-sized avatar

Dylan Brown djwbrown

View GitHub Profile
@djwbrown
djwbrown / pyplot_interrupt_handler.py
Last active April 11, 2022 10:24
matplotlib.pyplot blackmagic to make CTRL-C work again
import sys
import matplotlib.pyplot as plt
try:
# Put matplotlib.pyplot in interactive mode so that the plots are shown in a background thread.
plt.ion()
while(True):
plt.show()
except KeyboardInterrupt: