From ba7e2a5328e1e19eed3e78097bf85acd43d36094 Mon Sep 17 00:00:00 2001 From: Michael Stevenson Date: Mon, 28 Nov 2022 09:33:39 -0800 Subject: [PATCH] Handle open dialog canceled --- scripts/image_caption_gui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/image_caption_gui.py b/scripts/image_caption_gui.py index aeacc1f..8ed7334 100644 --- a/scripts/image_caption_gui.py +++ b/scripts/image_caption_gui.py @@ -60,7 +60,10 @@ class ImageView(tk.Frame): self.caption_frame.pack(fill=tk.Y, side=tk.RIGHT) def open_folder(self): - self.base_path = Path(filedialog.askdirectory()) + dir = filedialog.askdirectory() + if not dir: + return + self.base_path = Path(dir) if self.base_path is None: return self.images.clear()