fix: _btn pass font/corner_radius explicitly (no duplicate font in CTkButton/super kwargs)

Made-with: Cursor
This commit is contained in:
Dr Jones
2026-04-14 19:38:05 -07:00
parent 1bd07623c4
commit 862b07b837

View File

@@ -111,17 +111,25 @@ def main() -> None:
# HELPERS
# ─────────────────────────────────────────────────────────────────────────
def _btn(parent: Any, label: str, cmd: Any, w: int = 80, h: int = 28, **kw: Any) -> ctk.CTkButton:
# Merge defaults so callers can override font / colors without duplicate keyword errors.
defaults: dict[str, Any] = {
# Merge styling; pass font / corner_radius explicitly so nothing duplicates
# inside CTkButton (font must not appear in **kwargs passed to the base class).
merged: dict[str, Any] = {
"fg_color": ACCENT,
"hover_color": ACCENT2,
"text_color": TEXT,
"font": (FONT, 11),
**kw,
}
defaults.update(kw)
font = merged.pop("font", (FONT, 11))
corner_radius = merged.pop("corner_radius", 6)
return ctk.CTkButton(
parent, text=label, command=cmd, width=w, height=h,
corner_radius=6, **defaults,
parent,
text=label,
command=cmd,
width=w,
height=h,
corner_radius=corner_radius,
font=font,
**merged,
)
# ─────────────────────────────────────────────────────────────────────────