Made scrolling work
This commit is contained in:
parent
50d23fee0f
commit
75360e053d
13
mytwitter.py
13
mytwitter.py
|
@ -28,8 +28,11 @@ class TwitWindow:
|
||||||
# Create the scrolled frame that will hold the tweets
|
# Create the scrolled frame that will hold the tweets
|
||||||
self.tweet_view = Pmw.ScrolledFrame(self.tkroot, hscrollmode='none', horizflex='elastic')
|
self.tweet_view = Pmw.ScrolledFrame(self.tkroot, hscrollmode='none', horizflex='elastic')
|
||||||
self.tweet_view.pack(expand=Tkinter.YES, fill=Tkinter.BOTH)
|
self.tweet_view.pack(expand=Tkinter.YES, fill=Tkinter.BOTH)
|
||||||
self.tweet_view.bind("<Button-4>", self.scroll_wheel);
|
|
||||||
self.tweet_view.bind("<Button-5>", self.scroll_wheel);
|
# Bind scrollwheel to move the tweets. Might as well allow scrollwheel
|
||||||
|
# from anywhere, so we'll bind to tkroot
|
||||||
|
self.tkroot.bind("<Button-4>", self.scroll_wheel);
|
||||||
|
self.tkroot.bind("<Button-5>", self.scroll_wheel);
|
||||||
|
|
||||||
# Create labels and text widgets
|
# Create labels and text widgets
|
||||||
for i in range(0, self.num_entries):
|
for i in range(0, self.num_entries):
|
||||||
|
@ -79,11 +82,9 @@ class TwitWindow:
|
||||||
|
|
||||||
def scroll_wheel(self, event):
|
def scroll_wheel(self, event):
|
||||||
if event.num == 4:
|
if event.num == 4:
|
||||||
self.tweet_view.xview('scroll', 1, 'units');
|
self.tweet_view.yview('scroll', -5, 'units');
|
||||||
print "DEBUG: scrolling positive"
|
|
||||||
if event.num == 5:
|
if event.num == 5:
|
||||||
self.tweet_view.xview('scroll', -1, 'units');
|
self.tweet_view.yview('scroll', 5, 'units');
|
||||||
print "DEBUG: scrolling negative"
|
|
||||||
|
|
||||||
|
|
||||||
### end class TwitWindow
|
### end class TwitWindow
|
||||||
|
|
Reference in New Issue
Block a user