From 2ee5621b5956fbafb2b685e0bd52857824256341 Mon Sep 17 00:00:00 2001 From: Nenotriple <70049990+Nenotriple@users.noreply.github.com> Date: Mon, 27 Nov 2023 04:51:53 -0800 Subject: [PATCH] Button and checkbox highlight added A highlight when hovering over the widgets with a mouse has been added to the buttons/checkboxes. --- batch_token_delete.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/batch_token_delete.py b/batch_token_delete.py index 0548e3b..c2b1c44 100644 --- a/batch_token_delete.py +++ b/batch_token_delete.py @@ -67,10 +67,16 @@ def display_tokens(token_dict, directory, scrollable_frame, filter_text=''): label.pack(side=tk.LEFT) button = tk.Button(pair_frame, text=f"{token}", width=55, anchor="w", command=lambda t=token: (delete_token(directory, t, filter_text), display_tokens(count_tokens(directory), directory, scrollable_frame, filter_text))) button.pack(side=tk.LEFT) + enter, leave = create_hover_effect(button, "#ffcac9") + button.bind("", enter) + button.bind("", leave) var = tk.BooleanVar() checkbox = tk.Checkbutton(pair_frame, variable=var) checkbox.var = var checkbox.pack(side=tk.RIGHT) + enter, leave = create_hover_effect(checkbox, "#e5f3ff") + checkbox.bind("", enter) + checkbox.bind("", leave) checkbox.bind('', lambda event: toggle_all_checkboxes(event, scrollable_frame)) pair_frame.pack(side=tk.TOP, pady=2) @@ -131,6 +137,9 @@ def remove_duplicates(text): text = ','.join(text) return text +def create_hover_effect(widget, hover_color): + return (lambda event: widget.config(bg=hover_color), lambda event: widget.config(bg="SystemButtonFace")) + ################################################################################################################################################ ################################################################################################################################################ # # @@ -301,6 +310,7 @@ def main(directory=None): - Now that text is cleaned within the script, this is a standalone app! - Simply launch the "batch_token_delete.py" script and select a folder to manage text/tags in that folder. - Deleting tags using a "less than or equal to" threshold now displays the affected tags. + - A highlight has been added to the buttons/checkboxes.