diff options
author | emkael <emkael@tlen.pl> | 2019-06-23 12:40:00 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-06-23 12:40:00 +0200 |
commit | e932dc7e2e45cdd56f7ef5148335f758dbb26a7b (patch) | |
tree | 52ebc2101861e0571b42f9a360337ed5866730c4 /jfr_playoff/gui/frames/visual.py | |
parent | b8d98eb0e0f9fa7e695539164d61f90a271478d2 (diff) |
Refreshing match list dropdowns on match list change
Diffstat (limited to 'jfr_playoff/gui/frames/visual.py')
-rw-r--r-- | jfr_playoff/gui/frames/visual.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/jfr_playoff/gui/frames/visual.py b/jfr_playoff/gui/frames/visual.py index b36a5ec..372f02f 100644 --- a/jfr_playoff/gui/frames/visual.py +++ b/jfr_playoff/gui/frames/visual.py @@ -6,7 +6,7 @@ import tkColorChooser as tkcc from ..frames import GuiFrame, RepeatableFrame, ScrollableFrame from ..frames import WidgetRepeater -from ..frames import SelectionFrame +from ..frames import SelectionFrame, RefreshableOptionMenu from ..frames.team import TeamSelectionButton class VisualSettingsFrame(GuiFrame): @@ -141,13 +141,25 @@ class VisualSettingsFrame(GuiFrame): field.configure(state=tk.NORMAL if var.get() else tk.DISABLED) +class MatchList(RefreshableOptionMenu): + def __init__(self, *args, **kwargs): + RefreshableOptionMenu.__init__(self, *args, **kwargs) + self.winfo_toplevel().bind( + '<<MatchListChanged>>', self.refreshOptions, add='+') + self.configure(width=10) + + def getOptions(self): + return [match.label for match in self.winfo_toplevel().getMatches()] + + class BoxPositionFrame(RepeatableFrame): def renderContent(self): self.match = tk.StringVar() self.vertical = tk.IntVar() self.horizontal = tk.IntVar() self.horizontal.set(-1) - (ttk.OptionMenu(self, self.match)).grid(row=0, column=0) + self.matchBox = MatchList(self, self.match) + self.matchBox.grid(row=0, column=0) (ttk.Label(self, text=' w pionie:')).grid(row=0, column=1) (tk.Spinbox( self, textvariable=self.vertical, from_=0, to=9999, |