🚧 Add icons in toolbar

For #17
This commit is contained in:
Clement Desmidt 2023-06-15 12:12:52 +02:00 committed by Shikiryu
parent d8b6e7bd8c
commit 3b17dff7be
9 changed files with 39 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
assets/icons/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

BIN
assets/icons/flip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
assets/icons/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

BIN
assets/icons/maximize.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
assets/icons/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

BIN
assets/icons/timer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

View File

@ -1,4 +1,6 @@
pillow~=9.5.0
pyinstaller
pyinstaller==5.12.0
pygame~=2.4.0
customtkinter~=5.1.3
customtkinter~=5.1.3
configparser~=5.3.0
CTkToolTip~=0.4

View File

@ -3,6 +3,9 @@ import os
import subprocess
import sys
from tkinter import *
from CTkToolTip import *
from PIL import ImageTk, Image, ImageOps
import customtkinter
from src.util import Util
@ -20,34 +23,46 @@ class Toolbar:
toolbar = Frame(self.image_window.window, bd=1, relief=RAISED)
toolbar.pack(side=BOTTOM, fill=X)
next_button = customtkinter.CTkButton(toolbar, compound=LEFT, text="next ➡️",
command=self.image_window.next_image)
next_button = customtkinter.CTkButton(toolbar, image=ImageTk.PhotoImage(Image.open("assets/icons/next.png")),
text="", command=self.image_window.next_image)
next_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(next_button, delay=0.5, message="Next")
self.bw_button = customtkinter.CTkButton(toolbar, compound=LEFT, text="black&white",
command=self.toggle_black_white)
self.bw_button = customtkinter.CTkButton(toolbar, image=ImageTk.PhotoImage(Image.open("assets/icons/black-and"
"-white.png")),
text="", command=self.toggle_black_white)
self.bw_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.bw_button, delay=0.5, message="Black and white image")
self.mirror_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_mirror,
text="mirror")
self.mirror_button = customtkinter.CTkButton(toolbar, command=self.toggle_mirror, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/flip.png")))
self.mirror_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.mirror_button, delay=0.5, message="Mirrored image")
open_folder_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.open_folder,
text="open folder")
open_folder_button = customtkinter.CTkButton(toolbar, command=self.open_folder, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/folder.png")))
open_folder_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(open_folder_button, delay=0.5, message="Open folder")
self.always_on_top_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_always_on_top,
text="always on top")
self.always_on_top_button = customtkinter.CTkButton(toolbar, command=self.toggle_always_on_top, text="",
image=ImageTk.PhotoImage(
Image.open("assets/icons/copy.png")))
self.always_on_top_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.always_on_top_button, delay=0.5, message="Always on top")
self.fullscreen_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_fullscreen,
text="fullscreen")
self.fullscreen_button = customtkinter.CTkButton(toolbar, command=self.toggle_fullscreen, text="",
image=ImageTk.PhotoImage(
Image.open("assets/icons/maximize.png")))
self.fullscreen_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.fullscreen_button, delay=0.5, message="Fullscreen")
timer_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_timer, text="timer")
timer_button = customtkinter.CTkButton(toolbar, command=self.toggle_timer, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/timer.png")))
timer_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(timer_button, delay=0.5, message="Toggle timer")
self.timer_label = customtkinter.CTkLabel(toolbar, text=str(self.timer), text_color=Util.get_default_button_color())
self.timer_label = customtkinter.CTkLabel(toolbar, text=str(self.timer),
text_color=Util.get_default_button_color())
self.timer_label.pack(side=RIGHT, ipadx=20)
def display_new_timer(self):
@ -72,13 +87,15 @@ class Toolbar:
def toggle_black_white(self):
self.image_window.option["bw"] = not self.image_window.option["bw"]
self.bw_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["bw"] else Util.get_default_button_color())
self.bw_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"bw"] else Util.get_default_button_color())
self.image_window.image.apply_options()
def toggle_mirror(self):
self.image_window.option["mirror"] = not self.image_window.option["mirror"]
self.mirror_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["mirror"] else Util.get_default_button_color())
self.mirror_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"mirror"] else Util.get_default_button_color())
self.image_window.image.apply_options()
@ -112,6 +129,7 @@ class Toolbar:
def toggle_fullscreen(self):
self.image_window.option["fullscreen"] = not self.image_window.option["fullscreen"]
self.fullscreen_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["fullscreen"] else Util.get_default_button_color())
self.fullscreen_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"fullscreen"] else Util.get_default_button_color())
self.image_window.window.attributes("-fullscreen", self.image_window.option["fullscreen"])