listbox tkinter code example
Example 1: integrate label into listbox tkinter
import tkinter as tk
root = tk.Tk()
myList = tk.Listbox(root)
myText = "A list item"
myList.insert(tk.END, myText)
myList.pack()
lbl = tk.Label(myList, text=myText, anchor="w", font=("Helvetica", "24"))
lbl.pack(side="top", fill="x", anchor="w")
root.mainloop()
Example 2: list in tkinter messagebox
from tkinter import *
from tkinter import messagebox
def listMessageBox(arr):
window=Tk()
listbox=Listbox(window)
listbox.pack(fill=BOTH, expand=1)
[listbox.insert(END, row) for row in arr]
window.mainloop()
arr=['a','b','c','1','2','3']
listMessageBox(arr)