Skip to content

Commit ae6611b

Browse files
committed
More concise documentation. More expressive method names.
1 parent 605cd7d commit ae6611b

File tree

1 file changed

+7
-7
lines changed
  • ScrollableContainers

1 file changed

+7
-7
lines changed

ScrollableContainers/Tk.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def __init__(self, *args, **kwargs):
2323
# scrolling. Using the grid geometry manager ensures that the
2424
# horizontal and vertical scrollbars do not meet.
2525
self._canvas = tk.Canvas(self)
26-
self._canvas.bind('<Enter>', self._on_enter)
27-
self._canvas.bind('<Leave>', self._on_leave)
2826
self._canvas.bind('<Configure>', self._on_canvas_configure)
27+
self._canvas.bind('<Enter>', self._on_canvas_enter)
28+
self._canvas.bind('<Leave>', self._on_canvas_leave)
2929
self._canvas.grid(row=0, column=0, sticky=tk.NSEW)
3030

3131
xscrollbar = ttk.Scrollbar(self, orient=tk.HORIZONTAL, command=self._xview)
@@ -52,7 +52,7 @@ def __init__(self, *args, **kwargs):
5252

5353
def _xview(self, *args, width=None):
5454
'''
55-
Called when the horizontal scrollbar is moved. Called by some other callbacks
55+
Called when a horizontal scroll is requested. Called by some other callbacks
5656
(`_on_canvas_configure` and `_on_frame_configure`) whenever it is necessary to
5757
horizontally realign the contents of the canvas. Scroll the view only if the
5858
contents are not completely visible. Otherwise, move the scrollbar to such a
@@ -77,8 +77,8 @@ def _xview(self, *args, width=None):
7777

7878
def _yview(self, *args):
7979
'''
80-
Called when the vertical scrollbar is moved. Called indirectly when the mouse
81-
wheel is scrolled. Scroll the view only if it is not completely visible.
80+
Called when a vertical scroll is requested. Scroll the view only if the
81+
contents are not completely visible.
8282
8383
:param args: Tuple which can be passed to `tkinter.Canvas.yview`.
8484
'''
@@ -136,7 +136,7 @@ def _on_frame_expose(self, event=None):
136136

137137
###########################################################################
138138

139-
def _on_enter(self, event=None):
139+
def _on_canvas_enter(self, event=None):
140140
'''
141141
Called when the mouse pointer enters the canvas. Set up vertical scrolling with
142142
the mouse wheel.
@@ -150,7 +150,7 @@ def _on_enter(self, event=None):
150150

151151
###########################################################################
152152

153-
def _on_leave(self, event=None):
153+
def _on_canvas_leave(self, event=None):
154154
'''
155155
Called when the mouse pointer leaves the canvas. Unset vertical scrolling with
156156
the mouse wheel.

0 commit comments

Comments
 (0)