1from tkinter import *
2class ScrollBar:
3 def __init__(self):
4 root = Tk()
5 h = Scrollbar(root, orient = 'horizontal')
6 h.pack(side = BOTTOM, fill = X)
7 v = Scrollbar(root)
8 v.pack(side = RIGHT, fill = Y)
9 t = Text(root, width = 15, height = 15, wrap = NONE,
10 xscrollcommand = h.set,
11 yscrollcommand = v.set)
12 for i in range(20):
13 t.insert(END,"this is some text\n")
14 t.pack(side=TOP, fill=X)
15 h.config(command=t.xview)
16 v.config(command=t.yview)
17 root.mainloop()
18s = ScrollBar()