mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #6181: Fixed minor bugs in tkinter.Listbox methods:
bbox(), curselection() and get().
This commit is contained in:
commit
07bcf14b60
4 changed files with 60 additions and 29 deletions
|
@ -2591,22 +2591,19 @@ class Listbox(Widget, XView, YView):
|
|||
def activate(self, index):
|
||||
"""Activate item identified by INDEX."""
|
||||
self.tk.call(self._w, 'activate', index)
|
||||
def bbox(self, *args):
|
||||
def bbox(self, index):
|
||||
"""Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
|
||||
which encloses the item identified by index in ARGS."""
|
||||
return self._getints(
|
||||
self.tk.call((self._w, 'bbox') + args)) or None
|
||||
which encloses the item identified by the given index."""
|
||||
return self._getints(self.tk.call(self._w, 'bbox', index)) or None
|
||||
def curselection(self):
|
||||
"""Return list of indices of currently selected item."""
|
||||
# XXX Ought to apply self._getints()...
|
||||
return self.tk.splitlist(self.tk.call(
|
||||
self._w, 'curselection'))
|
||||
"""Return the indices of currently selected item."""
|
||||
return self._getints(self.tk.call(self._w, 'curselection')) or ()
|
||||
def delete(self, first, last=None):
|
||||
"""Delete items from FIRST to LAST (included)."""
|
||||
self.tk.call(self._w, 'delete', first, last)
|
||||
def get(self, first, last=None):
|
||||
"""Get list of items from FIRST to LAST (included)."""
|
||||
if last:
|
||||
if last is not None:
|
||||
return self.tk.splitlist(self.tk.call(
|
||||
self._w, 'get', first, last))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue