Staging: this is not the live site, pydocs.org.
Graphical user interfaces with Tk
A Listbox widget displays a list of single-line text items, one per line, of which the user can select one or more. The way the selection behaves is governed by the selectmode option, which is one of browse (the default; at most one item, which may be dragged with the mouse), single (at most one item), multiple (any number of items, toggled individually), or extended (any number of items, including discontiguous ranges, selected by clicking and dragging). Inherits from Widget, XView and YView, so the view can be scrolled horizontally and vertically with xview() and yview(). Refer to the Tk listbox manual page for the full list of options. Members of Listbox a activate Set the active item to the one given by index. b bbox Return a tuple (x, y, width, height) describing the bounding box, in pixels relative to the widget, of the text of the item given by index. c curselection Return a tuple containing the numerical indices of all of the items that are currently selected, or an empty tuple if no items are selected. d delete Delete the items in the range from first to last inclusive. g get If last is omitted, return the contents of the item given by first, or an empty string if first refers to a non-existent item. i index Return the integer index value corresponding to index, or None if index is out of range. insert Insert the given elements as new items just before the item given by index. itemcget Return the current value of the configuration option option for the item given by index. itemconfig Query or modify the configuration options of the item given by index. itemconfigure Query or modify the configuration options of the item given by index. n nearest Given a y-coordinate within the listbox window, return the index of the visible item nearest to that y-coordinate. s scan_dragto Scroll the listbox by 10 times the difference between x, y and the coordinates passed to the last scan_mark() call. scan_mark Record x, y and the current view, for use with later scan_dragto() calls. see Adjust the view so that the item given by index is visible. select_anchor Set the selection anchor to the item given by index. select_clear Deselect any of the items in the range from first to last inclusive that are selected. select_includes Return True if the item given by index is currently selected, False otherwise. select_set Select all of the items in the range from first to last inclusive, without affecting the selection state of items outside that range. selection_clear Deselect any of the items in the range from first to last inclusive that are selected. selection_includes Return True if the item given by index is currently selected, False otherwise. selection_set Select all of the items in the range from first to last inclusive, without affecting the selection state of items outside that range. size Return the total number of items in the listbox.
Python docs © Python Software Foundation · Examples CC0 ·
Source on GitHub · Not affiliated with the PSF