Comments on: Python Tkinter List Box https://coderslegacy.com/python/python-gui/python-tkinter-list-box/ Imparting knowledge to the Future Mon, 01 Apr 2024 23:31:25 +0000 hourly 1 By: mohamadg https://coderslegacy.com/python/python-gui/python-tkinter-list-box/#comment-2026 Wed, 30 Aug 2023 07:44:35 +0000 https://codersrefuge.000webhostapp.com/?page_id=969#comment-2026 In reply to David.

Note that the first parameter of the method listbox.insert() refers to the corresponding line number into which the value will be inserted. Please keep in mind that line numbers start at value 1.

]]>
By: David https://coderslegacy.com/python/python-gui/python-tkinter-list-box/#comment-1360 Mon, 08 Aug 2022 13:49:05 +0000 https://codersrefuge.000webhostapp.com/?page_id=969#comment-1360 I dont think the indexes for each selection is right in the example. From running the code myself, I’m seeing that “bread” prints out “0”, “milk” prints out “1”, etc. etc. Starts at zero instead of 1. It should look more like this:

listbox.insert(0, "Bread")
listbox.insert(1, "Milk")
listbox.insert(2, "Meat")
listbox.insert(3, "Cheese")
listbox.insert(4, "Vegetables")
]]>