From 7b864fe6914f0cecdfe6e21991b2a54046c96ca6 Mon Sep 17 00:00:00 2001 From: proneon267 Date: Mon, 28 Aug 2023 04:22:42 -0700 Subject: [PATCH] Fixed `winforms` implementation. --- winforms/src/toga_winforms/window.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/winforms/src/toga_winforms/window.py b/winforms/src/toga_winforms/window.py index 75d71a1a5c..ec473b0ba2 100644 --- a/winforms/src/toga_winforms/window.py +++ b/winforms/src/toga_winforms/window.py @@ -178,9 +178,11 @@ def resize_content(self): ) def window_on_gain_focus(self, sender, event): - self.interface.app.on_gain_focus(self.interface) + if self.interface.app is not None: + self.interface.app.on_gain_focus(self.interface) self.interface.on_gain_focus(self.interface) def window_on_lose_focus(self, sender, event): - self.interface.app.on_lose_focus(self.interface) + if self.interface.app is not None: + self.interface.app.on_lose_focus(self.interface) self.interface.on_lose_focus(self.interface)