Search on blog:

Tkinter Example: use after() to add to Listbox with Scrollbar [GB]

It shows how to create Listbox with Scrollbar (on right side) and how to use after() to insert new element on list every 1000ms (1s).

New element doesn't need '\n'

import tkinter as tk
import time

# --- functions ---

def add_line():
    listbox.insert('end', time.strftime("%H:%M:%S"))
    root.after(1000, add_line) # run again after 1000ms (1s)

# --- main ---

root = tk.Tk()

scrollbar = tk.Scrollbar(root)
scrollbar.pack(side='right', fill='y')

listbox = tk.Listbox(root, yscrollcommand=scrollbar.set)
listbox.pack(side='left', fill='both')


add_line() # run first time
If you like it
Buy a Coffee