from __future__ import annotations import tkinter as tk def disable_spinbox_mousewheel(root: tk.Misc) -> None: def block_spinbox_wheel(_event: tk.Event) -> str: return "break" for class_name in ("Spinbox", "TSpinbox"): for sequence in ("", "", "", ""): try: root.bind_class(class_name, sequence, block_spinbox_wheel) except Exception: pass