Skip to content

Commit 74b0c7e

Browse files
committed
Minor fixes.
1 parent 721d2ca commit 74b0c7e

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ScrollableContainers/Tk.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
__all__ = ['ScrollableFrameTk']
88

9+
_system = platform.system()
10+
911
###############################################################################
1012

1113
class ScrollableFrameTk(ttk.Frame):
@@ -43,8 +45,8 @@ def __init__(self, *args, **kwargs):
4345
# Initially, the vertical scrollbar is a hair below its topmost
4446
# position. Move it to said position. No harm in doing the equivalent
4547
# for the horizontal scrollbar.
46-
self._canvas.xview_moveto(0)
47-
self._canvas.yview_moveto(0)
48+
self._canvas.xview_moveto(0.0)
49+
self._canvas.yview_moveto(0.0)
4850

4951
###########################################################################
5052

@@ -165,9 +167,9 @@ def _on_leave(self, event=None):
165167
def _on_mouse_scroll(self, event):
166168
'''
167169
Called when the mouse wheel is scrolled or a two-finger swipe gesture is
168-
performed on the touchpad. Ask to scroll the view horizontally if Shift is held
169-
down (equivalent to a horizontal two-finger swipe) and vertically otherwise
170-
(equivalent to a vertical two-finger swipe).
170+
performed on the touchpad. Ask to scroll the view horizontally if the mouse
171+
wheel is scrolled with Shift held down (equivalent to a horizontal two-finger
172+
swipe) and vertically otherwise (equivalent to a vertical two-finger swipe).
171173
172174
:param event: Scroll event.
173175
'''
@@ -179,13 +181,12 @@ def _on_mouse_scroll(self, event):
179181
else:
180182
callee = self._yview
181183

182-
system = platform.system()
183-
if system == 'Linux':
184+
if _system == 'Linux':
184185
if event.num == 4:
185186
callee(tk.SCROLL, -1, tk.UNITS)
186187
elif event.num == 5:
187188
callee(tk.SCROLL, 1, tk.UNITS)
188-
elif system == 'Darwin':
189+
elif _system == 'Darwin':
189190
callee(tk.SCROLL, -event.delta, tk.UNITS)
190-
elif system == 'Windows':
191+
elif _system == 'Windows':
191192
callee(tk.SCROLL, -event.delta // 120, tk.UNITS)

ScrollableContainers/Wx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#! /usr/bin/python3 -B
22

33
import wx
4-
import wx.lib.scrolledpanel as scrolled
4+
import wx.lib.scrolledpanel as scrolledpanel
55

66
__all__ = ['ScrollablePanelWx']
77

88
###############################################################################
99

10-
class ScrollablePanelWx(scrolled.ScrolledPanel):
10+
class ScrollablePanelWx(scrolledpanel.ScrolledPanel):
1111
'''
1212
Container with horizontal and vertical scrolling capabilities. Widgets must be
1313
added to its `panel` attribute.

0 commit comments

Comments
 (0)