Tkinter is a GUI toolkit used in python to make user-friendly GUIs.Tkinter is the most commonly used and the most basic GUI framework available in python. Tkinter uses an object-oriented approach to make GUIs.
Note: For more information, refer to Python GUI – tkinter
The ListBox widget is used to display different types of items. These items must be of the same type of font and having the same font color. The items must also be of Text type. The user can select one or more items from the given list according to the requirement.
listbox = Listbox(root, bg, fg, bd, height, width, font, ..)
- root – root window.
- bg – background colour
- fg – foreground colour
- bd – border
- height – height of the widget.
- width – width of the widget.
- font – Font type of the text.
- highlightcolor – The colour of the list items when focused.
- yscrollcommand – for scrolling vertically.
- xscrollcommand – for scrolling horizontally.
- cursor – The cursor on the widget which can be an arrow, a dot etc.
- yview – allows the widget to be vertically scrollable.
- xview – allows the widget to be horizontally scrollable.
- get() – to get the list items in a given range.
- activate(index) – to select the lines with a specified index.
- size() – return the number of lines present.
- delete(start, last) – delete lines in the specified range.
- nearest(y) – returns the index of the nearest line.
- curseselection() – returns a tuple for all the line numbers that are being selected.
Example 2: Let’s Delete the elements from the above created listbox
- Scrollable ListBox in Python-tkinter
- Combobox Widget in tkinter | Python
- Python Tkinter - ScrolledText Widget
- Python | Menu widget in Tkinter
- Python Tkinter - Toplevel Widget
- Python | PanedWindow Widget in Tkinter
- Python Tkinter - Entry Widget
- Python Tkinter - Checkbutton Widget
- Python Tkinter - MessageBox Widget
- Python Tkinter - Text Widget
- Python Tkinter - Menubutton Widget
- Python Tkinter - Scale Widget
- Progressbar widget in Tkinter | Python
- Python Tkinter - Canvas Widget
- Python Tkinter - Frame Widget
- Creating Tabbed Widget With Python-Tkinter
- Python Tkinter - Validating Entry Widget
- Binding Function with double click with Tkinter ListBox
- Tkinter - Read only Entry Widget
- Create Find and Replace features in Tkinter Text Widget
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.