tkinter yscrollcommand code example

Example 1: tkinter minsize

from tkinter import *
root = Tk()
root.maxsize(height, width)
root.minsize(height, width) #(69, 420)
root.mainloop()

Example 2: scrollbar in tkinter

from Tkinter import *

root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill = Y )

mylist = Listbox(root, yscrollcommand = scrollbar.set )
for line in range(100):
   mylist.insert(END, "This is line number " + str(line))

mylist.pack( side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )

mainloop()