diff options
author | emkael <emkael@tlen.pl> | 2019-07-19 12:08:58 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-07-19 12:09:50 +0200 |
commit | d75941019eab5414b2b01d6689ce1a03b69499e6 (patch) | |
tree | 4a2ff8e1955ad1b56ed2887a6d9598b75bb7a3fa /jfr_playoff | |
parent | 800432587030b9e50ce985b5a072ee3411da1da6 (diff) |
Refactoring menu code
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/gui/__init__.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index e6e512f..b59b044 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -65,22 +65,13 @@ class PlayoffGUI(tk.Tk): def _buildMenu(self): menu = tk.Frame(self) menu.pack(side=tk.TOP, fill=tk.X) - (ttk.Button( - menu, - image=GuiImage.get_icon('new'), command=self.onNewFile)).pack( - side=tk.LEFT) - (ttk.Button( - menu, - image=GuiImage.get_icon('open'), command=self.onFileOpen)).pack( - side=tk.LEFT) - (ttk.Button( - menu, - image=GuiImage.get_icon('save'), command=self.onSave)).pack( - side=tk.LEFT) - (ttk.Button( - menu, - image=GuiImage.get_icon('saveas'), command=self.onSaveAs)).pack( - side=tk.LEFT) + for icon, command in [('new', self.onNewFile), + ('open', self.onFileOpen), + ('save', self.onSave), + ('saveas', self.onSaveAs)]: + (ttk.Button( + menu, image=GuiImage.get_icon(icon), command=command)).pack( + side=tk.LEFT) def onNewFile(self): self._checkSave() |