File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -216,18 +216,22 @@ def _scroll_viewport(self, event: tk.Event):
216
216
217
217
:param event: Scroll event.
218
218
"""
219
- # Select which method to call based on whether Shift was held down.
220
- # This is indicated by the LSB of the state.
221
- callee = self ._xview if event .state & 1 else self ._yview
222
219
match _system :
223
220
case "Linux" if event .num == 4 :
224
- callee ( tk . SCROLL , - 1 , tk . UNITS )
221
+ scroll_amount = - 1
225
222
case "Linux" if event .num == 5 :
226
- callee ( tk . SCROLL , 1 , tk . UNITS )
223
+ scroll_amount = 1
227
224
case "Darwin" :
228
- callee ( tk . SCROLL , - event .delta , tk . UNITS )
225
+ scroll_amount = - event .delta
229
226
case "Windows" :
230
- callee ( tk . SCROLL , - event .delta // 120 , tk . UNITS )
227
+ scroll_amount = - event .delta // 120
231
228
case _:
232
229
message = f"event { event .num } on OS { _system !r} is not supported"
233
230
raise ValueError (message )
231
+
232
+ # Select the method to call based on whether Shift was held down. This
233
+ # is indicated by the LSB of the state.
234
+ if event .state & 1 :
235
+ self ._xview (tk .SCROLL , scroll_amount , tk .UNITS )
236
+ else :
237
+ self ._yview (tk .SCROLL , scroll_amount , tk .UNITS )
You can’t perform that action at this time.
0 commit comments