diff --git a/ui/ctk_theme.py b/ui/ctk_theme.py index 41bb786..610a472 100644 --- a/ui/ctk_theme.py +++ b/ui/ctk_theme.py @@ -75,6 +75,18 @@ def create_ctk_toplevel( after_create: Optional[Callable[[Any], None]] = None, ) -> Any: root = ctk.CTkToplevel() + + if sys.platform == "win32": + def handle_ctrl_shortcut(event: Any) -> Optional[str]: + shortcuts = {65: ("a", "<>"), 67: ("c", "<>"), 86: ("v", "<>")} + shortcut = shortcuts.get(event.keycode) + if shortcut and event.keysym.lower() != shortcut[0] and not event.state & 0x20000: + event.widget.event_generate(shortcut[1]) + return "break" + return None + + root.bind("", handle_ctrl_shortcut, add="+") + root.title(title) root.resizable(False, False) center_ctk_geometry(root, width, height)