From 46a248a5cd7e0694c4a52dcd93b4e089074e4011 Mon Sep 17 00:00:00 2001 From: laffra Date: Fri, 19 Jan 2024 12:09:12 +0100 Subject: [PATCH] Set wheel event handler to handle Input[type=number] on Chrome --- examples/pizza.py | 6 ++++++ ltk/widgets.py | 1 + 2 files changed, 7 insertions(+) diff --git a/examples/pizza.py b/examples/pizza.py index d919bf7..60f9da3 100644 --- a/examples/pizza.py +++ b/examples/pizza.py @@ -22,6 +22,12 @@ def order(event): ltk.Heading1("Dave's Pizza Place"), ltk.HBox(ltk.Label("Date:"), ltk.DatePicker()), + + ltk.Break(), + ltk.VBox( + ltk.Label("Number of Pizzas:"), + ltk.Input(1).attr("type", "number") + ), ltk.Break(), ltk.HBox( diff --git a/ltk/widgets.py b/ltk/widgets.py index 7abcf5b..e670434 100644 --- a/ltk/widgets.py +++ b/ltk/widgets.py @@ -378,6 +378,7 @@ class Input(Widget): def __init__(self, value, style=DEFAULT_CSS): Widget.__init__(self, style) self.element.val(value) + self.on("wheel", lambda event: None) # ensure Chrome handles wheel events class Checkbox(Widget):