I have found this code about scrollbar is just working fine.
from tkinter import *
master = Tk()
scrollbar = Scrollbar(master)
scrollbar.pack(side=RIGHT,
END
, LEFT
, and BOTH
all reside in the tkinter
namespace. Thus, they need to be qualified by placing tk.
before them:
for i in range(1000):
self.lst1.insert(tk.END, str(i))
self.lst1.pack(side=tk.LEFT, fill=tk.BOTH)
scrollbar.config(command=lst1.yview)
Or, you could import them explicitly if you want:
from tkinter import BOTH, END, LEFT
use "end" instead of END
from tkinter import *
self.lst1.insert("end", str(i))