Making an Entry widget scrollable requires
a little extra code on your part to adapt the Scrollbar widget's callback to the methods
available on the Entry widget. Here are
some code fragments illustrating the setup. First, the
creation and linking of the Entry and
Scrollbar widgets:
self.entry = tk.Entry(self, width=10)
self.entry.grid(row=0, sticky=tk.E+tk.W)
self.entryScroll = tk.Scrollbar(self, orient=tk.HORIZONTAL,
command=self.__scrollHandler)
self.entryScroll.grid(row=1, sticky=tk.E+tk.W)
self.entry['xscrollcommand'] = self.entryScroll.set
Here's the adapter function referred to above:
def __scrollHandler(self, *L):
op, howMany = L[0], L[1]
if op == 'scroll':
units = L[2]
self.entry.xview_scroll(howMany, units)
elif op == 'moveto':
self.entry.xview_moveto(howMany)