from tkinter import *

app = Tk()

label1_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check1', font=('bold',12), pady=10, padx=20)
part_label.grid(row=0, column=0, sticky=W)
label1_entry = Entry(app, textvariable=label1_text)
label1_entry.grid(row=0, column=1)

label2_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check1', font=('bold', 12), pady=7, padx=20)
part_label.grid(row=1, column=0, sticky=W)
label2_entry = Entry(app, textvariable=label2_text)
label2_entry.grid(row=1, column=1)

label3_text = StringVar()
part_label = Label(app, bg='#dfe3ee', text='Check3', font=('bold', 12), pady=20)
part_label.grid(row=0, column=2)
label3_entry = Entry(app, textvariable=label3_text)
label3_entry.grid(row=0, column=3)

label4 = StringVar()
part_label = Label(app, bg='#dfe3ee', text='check4', font=('bold', 12), pady=7)
part_label.grid(row=1, column=2)
label4_entry = Entry(app, textvariable=label4)
label4_entry.grid(row=1, column=3)

B1_btn = Button(app, bg='#cd8de5', text='Button1',font=('bold', 11), width=12)
B1_btn.grid(row=3, column=1, padx=0, pady=5)

B2_btn = Button(app, bg='#cd8de5', text='Button2',font=('bold', 11), width=12 )
B2_btn.grid(row=4, column=1, padx=0, pady=5)

B3_btn = Button(app, bg='#d5a6e6', text='close',font=('bold', 11), width=12)
B3_btn.grid(row=50, column=2, sticky='E')

output_list = Listbox(app, height=20, width=100, border=5)
output_list.grid(row=20, column=0, columnspan=3, rowspan=6, pady=20, padx=20)

scrollbar = Scrollbar(app)
scrollbar.grid(row=20, column =3, rowspan=5, sticky=(N+S))

output_list.configure(yscrollcommand=scrollbar.set)
scrollbar.configure(command=output_list.yview)

app.title('Test Tool')
app.geometry('900x900')
app.configure(bg='#dfe3ee')

app.mainloop()

Put something in the listbox to scroll

import tkinter

def test_callback(event=None):
   listbox.insert(tkinter.END, "new_item #1")

   listbox.insert(tkinter.END, "new_item #2")
   listbox.update()

top = tkinter.Tk()
top.geometry( "100x100+10+10" )
top.minsize( 200, 200 )

listbox = tkinter.Listbox( top, height=6, width=20, font=('Fixed', 14), foreground='blue' )
scrolly = tkinter.Scrollbar( top, command=listbox.yview )
listbox.configure(yscrollcommand=scrolly.set)

scrollx = tkinter.Scrollbar( top, orient=tkinter.HORIZONTAL, command=listbox.xview )
listbox.configure(xscrollcommand=scrollx.set)

lit = [ "aaa", "bbbbb", "ccccccc", "dd", "e", \
        "fff", "ggggg", "hhhhhhh", "jj", "m", "nn" ]
ctr = 0
for item in range( len(lit) ):
    this_lit = lit[item]
    new_item = "%d  %-10s  %-10s  %-10s" % \
                (item, this_lit, this_lit, this_lit)
    listbox.insert(tkinter.END, new_item)

listbox.itemconfig(2, background="lightblue")
listbox.itemconfig(9, background="yellow")

cont = tkinter.Button(top, text='CONTINUE',
       command=top.quit, bg='red', fg='white', width=10, height=2 )
cont.pack(side="bottom", fill=tkinter.X, expand=1)
scrolly.pack(side="right", fill="y")
scrollx.pack(side="bottom", fill=tkinter.X, expand=1)
listbox.pack(side="left")

listbox.see(3)   ## puts item #3 at the top
listbox.itemconfig(5, background="gray")

listbox.bind("<Double-Button-1>", test_callback)    
top.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.