From 3a3c84f742384b7db90a9957f162369dea02e377 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Tue, 30 Oct 2018 17:01:25 -0500 Subject: [PATCH] support canceling the selection process --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index edf0ac4..faf43a9 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,11 @@ def gen_list(objs,data,*displays,key = None,sort = 0,num_pic = True): which = None while not which: try: - which = srt_keys[int(input('Which one?: '))] + which = input('Which one?: ') + except KeyboardInterrupt: + quit() + try: + which = srt_keys[int(which)] except ValueError: which = None return display_data[which]