From d950295df7b04bc8b724544d088a45d0bfad1c4d Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Mon, 17 Apr 2023 13:41:48 -0400 Subject: [PATCH] Simply close the Open dialog if you select the open file --- paint.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paint.py b/paint.py index 7f1972f..d4b1b82 100644 --- a/paint.py +++ b/paint.py @@ -960,6 +960,9 @@ class PaintApp(App): if self.directory_tree_selected_path: filename = os.path.join(self.directory_tree_selected_path, filename) if filename: + if self.filename and os.path.samefile(filename, self.filename): + window.close() + return with open(filename, "r") as f: content = f.read() # f is out of scope in go_ahead() def go_ahead():