I have a text widget with a horizontal and vertical scroll bar. I would like to be able to scroll up and down normally, and scroll side to side while holding shift. I can't figure out what to bind the <Shift-MouseWheel>
event to, or what the callback ought to be. Here's a code snippet of the mainWindow(Tk.TopLevel)'s __init__():
# console text
self.yScroll = Tk.Scrollbar(self)
self.yScroll.pack(side=Tk.RIGHT, fill=Tk.Y)
self.xScroll = Tk.Scrollbar(self)
self.xScroll.pack(side=Tk.BOTTOM, fill=Tk.X)
self.log = Tk.Text(self,
wrap=Tk.NONE,
width=80,
height=24,
yscrollcommand=self.yScroll.set,
xscrollcommand=self.xScroll.set)
self.log.pack()
self.yScroll.config(command=self.log.yview)
self.xScroll.config(command=self.log.xview, orient=Tk.HORIZONTAL)
# shift scroll binding
self.bind('<Shift-MouseWheel>', ) # what do I need here?
I have successfully bound the shift-scroll to simple print functions, etc. but I'm not sure how to bind it to the text box scrolling.