Skip to content

Commit 4e0271f

Browse files
committed
Ensure recompute is called from width and height properties
1 parent 6b87062 commit 4e0271f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gtk/src/toga_gtk/container.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TogaContainer(Gtk.Box):
110110
def __init__(self):
111111
super().__init__()
112112

113-
# Because we dont have access to the existing layout manager, we must
113+
# Because we don't have access to the existing layout manager, we must
114114
# create our custom layout manager class.
115115
layout_manager = TogaContainerLayoutManager()
116116
self.set_layout_manager(layout_manager)
@@ -150,9 +150,11 @@ def width(self):
150150
"""
151151
if self._content is None:
152152
return 0
153-
return self.get_width()
153+
154154
if self._dirty_widgets and self.needs_redraw:
155155
self.recompute()
156+
width = self.get_width()
157+
return width
156158

157159
@property
158160
def height(self):
@@ -162,9 +164,11 @@ def height(self):
162164
"""
163165
if self._content is None:
164166
return 0
165-
return self.get_height()
167+
166168
if self._dirty_widgets and self.needs_redraw:
167169
self.recompute()
170+
height = self.get_height()
171+
return height
168172

169173
@property
170174
def content(self):

0 commit comments

Comments
 (0)