From 39de57c1e19242b295637c7875cb6f684c93bda3 Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Thu, 20 Jun 2019 08:37:51 +0200 Subject: [PATCH] Bug fiex: root = tk.TK() must be destroyied as well --- flatland/utils/graphics_pil.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index ffa3324..c7cb8fa 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -75,6 +75,7 @@ class PILGL(GraphicsLayer): self.ltAgentColors = [self.rgb_s2i(sColor) for sColor in sColors.split("#")] self.nAgentColors = len(self.ltAgentColors) + self.window_root = None self.window_open = False self.firstFrame = True self.create_layers() @@ -131,9 +132,9 @@ class PILGL(GraphicsLayer): assert self.window_open is False, "Window is already open!" # use tk.Toplevel() instead of tk.Tk() # https://stackoverflow.com/questions/26097811/image-pyimage2-doesnt-exist - root = tk.Tk() - root.withdraw() - self.window = tk.Toplevel(root) + self.window_root = tk.Tk() + self.window_root.withdraw() + self.window = tk.Toplevel(self.window_root) self.window.title("Flatland") self.window.configure(background='grey') self.window_open = True @@ -142,6 +143,8 @@ class PILGL(GraphicsLayer): self.panel.destroy() self.window.quit() self.window.destroy() + self.window_root.destroy() + self.window = None def text(self, *args, **kwargs): pass -- GitLab