summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/Tkinter.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-13 13:37:30 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-13 13:37:30 (GMT)
commit243ac4f4974af46934c3ad67eb4a173553628b76 (patch)
treee1d769994fa5a54c837b92cceb6f1a80ba7e3ad8 /Lib/lib-tk/Tkinter.py
parent439c467a0ca2c0882629a19cd89a1f3242172607 (diff)
downloadcpython-243ac4f4974af46934c3ad67eb4a173553628b76.zip
cpython-243ac4f4974af46934c3ad67eb4a173553628b76.tar.gz
cpython-243ac4f4974af46934c3ad67eb4a173553628b76.tar.bz2
Updated listbox methods to Tk 8.0. (Moved some around, added
x/yview_scroll/moveto.)
Diffstat (limited to 'Lib/lib-tk/Tkinter.py')
-rw-r--r--Lib/lib-tk/Tkinter.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 5c28084..40b913d 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -1397,6 +1397,10 @@ class Listbox(Widget):
self._w, 'get', first, last))
else:
return self.tk.call(self._w, 'get', first)
+ def index(self, index):
+ i = self.tk.call(self._w, 'index', index)
+ if i == 'none': return None
+ return getint(i)
def insert(self, index, *elements):
self.tk.call((self._w, 'insert', index) + elements)
def nearest(self, y):
@@ -1408,34 +1412,38 @@ class Listbox(Widget):
self.tk.call(self._w, 'scan', 'dragto', x, y)
def see(self, index):
self.tk.call(self._w, 'see', index)
- def index(self, index):
- i = self.tk.call(self._w, 'index', index)
- if i == 'none': return None
- return getint(i)
- def select_anchor(self, index):
+ def selection_anchor(self, index):
self.tk.call(self._w, 'selection', 'anchor', index)
- selection_anchor = select_anchor
- def select_clear(self, first, last=None):
+ select_anchor = selection_anchor
+ def selection_clear(self, first, last=None):
self.tk.call(self._w,
'selection', 'clear', first, last)
- selection_clear = select_clear
- def select_includes(self, index):
+ select_clear = selection_clear
+ def selection_includes(self, index):
return self.tk.getboolean(self.tk.call(
self._w, 'selection', 'includes', index))
- selection_includes = select_includes
- def select_set(self, first, last=None):
+ select_includes = selection_includes
+ def selection_set(self, first, last=None):
self.tk.call(self._w, 'selection', 'set', first, last)
- selection_set = select_set
+ select_set = selection_set
def size(self):
return getint(self.tk.call(self._w, 'size'))
def xview(self, *what):
if not what:
return self._getdoubles(self.tk.call(self._w, 'xview'))
self.tk.call((self._w, 'xview') + what)
+ def xview_moveto(self, fraction):
+ self.tk.call(self._w, 'xview', 'moveto', fraction)
+ def xview_scroll(self, number, what):
+ self.tk.call(self._w, 'xview', 'scroll', number, what)
def yview(self, *what):
if not what:
return self._getdoubles(self.tk.call(self._w, 'yview'))
self.tk.call((self._w, 'yview') + what)
+ def yview_moveto(self, fraction):
+ self.tk.call(self._w, 'yview', 'moveto', fraction)
+ def yview_scroll(self, number, what):
+ self.tk.call(self._w, 'yview', 'scroll', number, what)
class Menu(Widget):
def __init__(self, master=None, cnf={}, **kw):