Add item to ListBox : ListBox « Tkinker « Python Tutorial






Add item to ListBox
from Tkinter import *
root = Tk()

scrollbar = Scrollbar(root, orient=HORIZONTAL)
scrollbar.pack(side=BOTTOM, fill=X)

mylist = Listbox(root, xscrollcommand=scrollbar.set)
for line in range(100):
    msg = "number is " + str(line)
    mylist.insert(END, msg)
mylist.pack(side=LEFT, fill=BOTH)

scrollbar.config(command=mylist.xview)
mainloop()








18.19.ListBox
18.19.1.Add item to ListBoxAdd item to ListBox
18.19.2.ListBox with scroll barListBox with scroll bar
18.19.3.Creating a multiple selection list.Creating a multiple selection list.
18.19.4.Add item to the end of ListBoxAdd item to the end of ListBox
18.19.5.Remove the selected itemsRemove the selected items
18.19.6.Scrolled listScrolled list