Skip to content

Commit cfb4dab

Browse files
committed
Fix clock icon and add tooltip
1 parent bdf3629 commit cfb4dab

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Assets/Icons/clock.png

2.42 KB
Loading

toolbar.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from dataclasses import dataclass
1010
from pathlib import Path
1111
import tkinter as tk
12+
from idlelib.tooltip import Hovertip # type: ignore
1213

1314
from component_sketch import ComponentSketcher
1415
from dataCDLT import INPUT, OUTPUT, FREE, CLOCK
@@ -76,11 +77,11 @@ def create_topbar(self, parent: tk.Tk):
7677
images = self.load_images()
7778

7879
# Create buttons in the left frame
79-
self.create_button("Connection", left_frame, images)
80+
self.create_button("Connection", left_frame, images, "Ajouter une connexion")
8081
# self.create_button("Power", left_frame, images) # à ajouter après si besoin
81-
self.create_button("Input", left_frame, images)
82-
self.create_button("Output", left_frame, images)
83-
self.create_button("Clock", left_frame, images)
82+
self.create_button("Input", left_frame, images, "Ajouter une entrée")
83+
self.create_button("Output", left_frame, images, "Ajouter une sortie")
84+
self.create_button("Clock", left_frame, images, "Ajouter une horloge")
8485

8586
# Create the color chooser and Delete button in the right frame
8687
self.color_button = Button(
@@ -95,7 +96,7 @@ def create_topbar(self, parent: tk.Tk):
9596
highlightthickness=0,
9697
)
9798
self.color_button.pack(side=tk.LEFT, padx=2, pady=2)
98-
self.create_button("Delete", right_frame, images)
99+
self.create_button("Delete", right_frame, images, "Supprimer un composant")
99100

100101
def load_images(self) -> dict[str, tk.PhotoImage | None]:
101102
"""
@@ -123,7 +124,7 @@ def load_images(self) -> dict[str, tk.PhotoImage | None]:
123124

124125
return images
125126

126-
def create_button(self, action: str, parent_frame: tk.Frame, images: dict[str, tk.PhotoImage | None]) -> None:
127+
def create_button(self, action: str, parent_frame: tk.Frame, images: dict[str, tk.PhotoImage | None], hovertext: str) -> None:
127128
"""
128129
Helper method to create a button in the specified frame with an icon.
129130
@@ -164,6 +165,7 @@ def create_button(self, action: str, parent_frame: tk.Frame, images: dict[str, t
164165
borderwidth=0,
165166
highlightthickness=0,
166167
)
168+
Hovertip(btn, hovertext, 500)
167169
btn.pack(side=tk.LEFT, padx=10, pady=2) # Minimal spacing between buttons
168170
self.buttons[action] = btn # Store button reference
169171

0 commit comments

Comments
 (0)