From 185ffdcbfdd5246e127762ad0b290e99116a0215 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 28 Jun 2019 12:00:30 +0200 Subject: Fixing button alignment in headered repeaters --- jfr_playoff/gui/frames/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py index 4d8ad13..dd4f632 100644 --- a/jfr_playoff/gui/frames/__init__.py +++ b/jfr_playoff/gui/frames/__init__.py @@ -48,10 +48,12 @@ class WidgetRepeater(tk.Frame): return None def _createWidget(self, widgetClass, widgetClassParams=None): + headeridx = int(self.headerFrame is not None) removeButton = ttk.Button( self, text='[-]', width=5, command=lambda i=len(self.widgets): self._removeWidget(i)) - removeButton.grid(row=len(self.widgets), column=0, sticky=tk.N) + removeButton.grid( + row=len(self.widgets)+headeridx, column=0, sticky=tk.N) widget = widgetClass(self) if widgetClassParams is not None: widget.configureContent(**widgetClassParams) @@ -96,7 +98,8 @@ class WidgetRepeater(tk.Frame): if self.headerFrame is not None: self.headerFrame.grid(row=0, column=1, sticky=tk.W+tk.E+tk.N+tk.S) self.addButton.grid( - row=len(self.widgets), column=0, columnspan=1, sticky=tk.W+tk.N) + row=len(self.widgets)+headeridx, column=0, columnspan=1, + sticky=tk.W+tk.N) def _renderHeader(self): if self.headers: -- cgit v1.2.3