16 lines
474 B
Python
16 lines
474 B
Python
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 ("<MouseWheel>", "<Shift-MouseWheel>", "<Button-4>", "<Button-5>"):
|
|
try:
|
|
root.bind_class(class_name, sequence, block_spinbox_wheel)
|
|
except Exception:
|
|
pass
|