From 508e384858c1af13feee941f8bbec08f118ce06c Mon Sep 17 00:00:00 2001 From: Clement Desmidt Date: Wed, 24 May 2023 14:28:56 +0200 Subject: [PATCH] :sparkles: Add fullscreen Fix #23 --- src/element/toolbar.py | 29 +++++++++++++++++------------ src/window/image.py | 1 + 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/element/toolbar.py b/src/element/toolbar.py index d3d8ce8..eadf2c8 100644 --- a/src/element/toolbar.py +++ b/src/element/toolbar.py @@ -11,10 +11,9 @@ class Toolbar: self.current_image = None self.current_original_image = None self.image_window = image_window - self.timer = timer - self.timer_label = None self.timer_check = None + self.always_on_top_check = None toolbar = Frame(self.image_window.window, bd=1, relief=RAISED) toolbar.pack(side=BOTTOM, fill=X) @@ -30,19 +29,19 @@ class Toolbar: text="mirror") self.mirror_button.pack(side=LEFT, padx=0, pady=0) - self.open_folder_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.open_folder - , text="open folder") - self.open_folder_button.pack(side=LEFT, padx=0, pady=0) + open_folder_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.open_folder, text="open folder") + open_folder_button.pack(side=LEFT, padx=0, pady=0) - self.always_on_top_button = Button(toolbar, relief=FLAT, compound=LEFT, - command=self.toggle_always_on_top - , text="always on top") + self.always_on_top_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_always_on_top, + text="always on top") self.always_on_top_button.pack(side=LEFT, padx=0, pady=0) - self.always_on_top_check = None - self.timer_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_timer, - text="timer") - self.timer_button.pack(side=LEFT, padx=0, pady=0) + self.fullscreen_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_fullscreen, + text="fullscreen") + self.fullscreen_button.pack(side=LEFT, padx=0, pady=0) + + timer_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_timer, text="timer") + timer_button.pack(side=LEFT, padx=0, pady=0) self.timer_label = Label(toolbar, text=self.timer) self.timer_label.pack(side=RIGHT, ipadx=20) @@ -105,3 +104,9 @@ class Toolbar: # self.window.lift() self.image_window.window.attributes('-topmost', True) self.always_on_top_check = self.image_window.window.after(2000, self.stay_on_top) + + def toggle_fullscreen(self): + self.image_window.option["fullscreen"] = not self.image_window.option["fullscreen"] + self.fullscreen_button.config(bg="blue" if self.image_window.option["fullscreen"] else "grey85") + + self.image_window.window.attributes("-fullscreen", self.image_window.option["fullscreen"]) diff --git a/src/window/image.py b/src/window/image.py index 9d16c13..56472a5 100644 --- a/src/window/image.py +++ b/src/window/image.py @@ -17,6 +17,7 @@ class ImageWindow: "bw": False, "mirror": False, "always_on_top": False, + "fullscreen": False, } mixer.init()