How to add a list into a listbox in tkinter

This script shows how it is possible to put a list into a listbox, without having to iterate trough one, but just doing so:

import tkinter as tk
import tkinter.ttk as ttk


root = tk.Tk()
root.geometry("400x400")
food_list = ['apple', 'banana', 'orange']
list1 = tk.StringVar(value=food_list)
lst = tk.Listbox(root,
	listvariable=list1)
lst.pack()

root.mainloop()
The window with the listbox that gets a list as items

Subscribe to the newsletter for updates
Tkinter templates
My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts