MCPcopy Index your code
hub / github.com/python/cpython / wheel_event

Function wheel_event

Lib/idlelib/tree.py:59–81  ·  view source on GitHub ↗

Handle scrollwheel event. For wheel up, event.delta = 120*n on Windows, -1*n on darwin, where n can be > 1 if one scrolls fast. Flicking the wheel generates up to maybe 20 events with n up to 10 or more 1. Macs use wheel down (delta = 1*n) to scroll up, so positive delta means

(event, widget=None)

Source from the content-addressed store, hash-verified

57 root.images = images
58
59def wheel_event(event, widget=None):
60 """Handle scrollwheel event.
61
62 For wheel up, event.delta = 120*n on Windows, -1*n on darwin,
63 where n can be > 1 if one scrolls fast. Flicking the wheel
64 generates up to maybe 20 events with n up to 10 or more 1.
65 Macs use wheel down (delta = 1*n) to scroll up, so positive
66 delta means to scroll up on both systems.
67
68 X-11 sends Control-Button-4,5 events instead.
69
70 The widget parameter is needed so browser label bindings can pass
71 the underlying canvas.
72
73 This function depends on widget.yview to not be overridden by
74 a subclass.
75 """
76 up = {EventType.MouseWheel: event.delta > 0,
77 EventType.ButtonPress: event.num == 4}
78 lines = -5 if up[event.type] else 5
79 widget = event.widget if widget is None else widget
80 widget.yview(SCROLL, lines, 'units')
81 return 'break'
82
83
84class TreeNode:

Callers 1

drawtextMethod · 0.85

Calls 1

yviewMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…