summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/frames/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff/gui/frames/__init__.py')
-rw-r--r--jfr_playoff/gui/frames/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py
index 4c4950e..50860b1 100644
--- a/jfr_playoff/gui/frames/__init__.py
+++ b/jfr_playoff/gui/frames/__init__.py
@@ -308,3 +308,21 @@ class SelectionFrame(ScrollableFrame):
self.renderOption(container, option, idx)
if self.selected and self.selected(idx, option):
self.values[idx].set(True)
+
+class RefreshableOptionMenu(ttk.OptionMenu):
+ def __init__(self, *args, **kwargs):
+ ttk.OptionMenu.__init__(self, *args, **kwargs)
+ self.refreshOptions()
+
+ def refreshOptions(self, *args):
+ oldValue = self._variable.get()
+ options = self.getOptions()
+ self['menu'].delete(0, tk.END)
+ for option in options:
+ self['menu'].add_command(
+ label=option, command=tk._setit(self._variable, option))
+ if oldValue not in options:
+ self._variable.set('')
+
+ def getOptions(self):
+ pass