From e74b884382506efd81b349257c8205753dfd0172 Mon Sep 17 00:00:00 2001 From: Thorsten Wagner Date: Fri, 9 Aug 2019 13:20:29 +0200 Subject: [PATCH] Fix text wrapping in 1.0.3-release This fixes the problem reported in https://github.com/chriskiehl/Gooey/issues/463 --- gooey/gui/components/util/wrapped_static_text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gooey/gui/components/util/wrapped_static_text.py b/gooey/gui/components/util/wrapped_static_text.py index 350e656..3a004f3 100644 --- a/gooey/gui/components/util/wrapped_static_text.py +++ b/gooey/gui/components/util/wrapped_static_text.py @@ -33,6 +33,7 @@ class AutoWrappedStaticText(wx.StaticText): super(AutoWrappedStaticText, self).__init__(parent, *args, **kwargs) self.label = kwargs.get('label') self.Bind(wx.EVT_SIZE, self.OnSize) + self.parent = parent def OnSize(self, event): @@ -46,7 +47,7 @@ class AutoWrappedStaticText(wx.StaticText): if self.target: self.Wrap(self.target.GetSize().width) else: - self.Wrap(event.GetSize().width) + self.Wrap(self.parent.GetSize()[0]) def Wrap(self, width): """ @@ -93,4 +94,4 @@ class AutoWrappedStaticText(wx.StaticText): if not wrapped: self.label = label - wx.StaticText.SetLabel(self, label) \ No newline at end of file + wx.StaticText.SetLabel(self, label)