MCPcopy Index your code
hub / github.com/RustPython/RustPython / Listbox

Class Listbox

Lib/tkinter/__init__.py:3368–3481  ·  view source on GitHub ↗

Listbox widget which can display a list of strings.

Source from the content-addressed store, hash-verified

3366
3367
3368class Listbox(Widget, XView, YView):
3369 """Listbox widget which can display a list of strings."""
3370
3371 def __init__(self, master=None, cnf={}, **kw):
3372 """Construct a listbox widget with the parent MASTER.
3373
3374 Valid resource names: background, bd, bg, borderwidth, cursor,
3375 exportselection, fg, font, foreground, height, highlightbackground,
3376 highlightcolor, highlightthickness, relief, selectbackground,
3377 selectborderwidth, selectforeground, selectmode, setgrid, takefocus,
3378 width, xscrollcommand, yscrollcommand, listvariable."""
3379 Widget.__init__(self, master, 'listbox', cnf, kw)
3380
3381 def activate(self, index):
3382 """Activate item identified by INDEX."""
3383 self.tk.call(self._w, 'activate', index)
3384
3385 def bbox(self, index):
3386 """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
3387 which encloses the item identified by the given index."""
3388 return self._getints(self.tk.call(self._w, 'bbox', index)) or None
3389
3390 def curselection(self):
3391 """Return the indices of currently selected item."""
3392 return self._getints(self.tk.call(self._w, 'curselection')) or ()
3393
3394 def delete(self, first, last=None):
3395 """Delete items from FIRST to LAST (included)."""
3396 self.tk.call(self._w, 'delete', first, last)
3397
3398 def get(self, first, last=None):
3399 """Get list of items from FIRST to LAST (included)."""
3400 if last is not None:
3401 return self.tk.splitlist(self.tk.call(
3402 self._w, 'get', first, last))
3403 else:
3404 return self.tk.call(self._w, 'get', first)
3405
3406 def index(self, index):
3407 """Return index of item identified with INDEX."""
3408 i = self.tk.call(self._w, 'index', index)
3409 if i == 'none': return None
3410 return self.tk.getint(i)
3411
3412 def insert(self, index, *elements):
3413 """Insert ELEMENTS at INDEX."""
3414 self.tk.call((self._w, 'insert', index) + elements)
3415
3416 def nearest(self, y):
3417 """Get index of item which is nearest to y coordinate Y."""
3418 return self.tk.getint(self.tk.call(
3419 self._w, 'nearest', y))
3420
3421 def scan_mark(self, x, y):
3422 """Remember the current X, Y coordinates."""
3423 self.tk.call(self._w, 'scan', 'mark', x, y)
3424
3425 def scan_dragto(self, x, y):

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected