Make palette swatches borderless
This commit is contained in:
parent
7ef8ce08d0
commit
21c22692a5
|
|
@ -169,18 +169,16 @@ class UIBuilderMixin:
|
||||||
def _add_palette_swatch(self, parent, name: str, hex_code: str) -> None:
|
def _add_palette_swatch(self, parent, name: str, hex_code: str) -> None:
|
||||||
swatch = tk.Canvas(
|
swatch = tk.Canvas(
|
||||||
parent,
|
parent,
|
||||||
width=26,
|
width=24,
|
||||||
height=26,
|
height=24,
|
||||||
highlightthickness=1,
|
highlightthickness=0,
|
||||||
highlightbackground="#b1b1b6",
|
background=hex_code,
|
||||||
background="#ffffff",
|
|
||||||
bd=0,
|
bd=0,
|
||||||
relief="flat",
|
relief="flat",
|
||||||
takefocus=1,
|
takefocus=1,
|
||||||
cursor="hand2",
|
cursor="hand2",
|
||||||
)
|
)
|
||||||
swatch.pack(side=tk.LEFT, padx=4, pady=2)
|
swatch.pack(side=tk.LEFT, padx=4, pady=2)
|
||||||
swatch.create_rectangle(3, 3, 23, 23, outline="#4a4a4a", fill=hex_code)
|
|
||||||
|
|
||||||
def trigger(_event=None, colour=hex_code, label=name):
|
def trigger(_event=None, colour=hex_code, label=name):
|
||||||
self.apply_sample_colour(colour, label)
|
self.apply_sample_colour(colour, label)
|
||||||
|
|
@ -188,8 +186,8 @@ class UIBuilderMixin:
|
||||||
swatch.bind("<Button-1>", trigger)
|
swatch.bind("<Button-1>", trigger)
|
||||||
swatch.bind("<space>", trigger)
|
swatch.bind("<space>", trigger)
|
||||||
swatch.bind("<Return>", trigger)
|
swatch.bind("<Return>", trigger)
|
||||||
swatch.bind("<Enter>", lambda _e: swatch.configure(highlightbackground="#71717a"))
|
swatch.bind("<Enter>", lambda _e: swatch.configure(highlightthickness=1, highlightbackground="#71717a"))
|
||||||
swatch.bind("<Leave>", lambda _e: swatch.configure(highlightbackground="#b1b1b6"))
|
swatch.bind("<Leave>", lambda _e: swatch.configure(highlightthickness=0))
|
||||||
|
|
||||||
def _add_toolbar_button(self, parent, text: str, command) -> None:
|
def _add_toolbar_button(self, parent, text: str, command) -> None:
|
||||||
font = tkfont.Font(root=self.root, family="Segoe UI", size=9)
|
font = tkfont.Font(root=self.root, family="Segoe UI", size=9)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue