summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/__init__.py
diff options
context:
space:
mode:
authorJuliette Monsel <j4321@users.noreply.github.com>2018-10-08 16:29:24 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-10-08 16:29:24 (GMT)
commitaf5658ae93b0a87ab4420a7dc30a07fa5a83e252 (patch)
tree88fc472ba5b1de85818b1603c7b69ba19addc3d4 /Lib/tkinter/__init__.py
parenta8d5e2f255f1a20fc8af7dc16a7cb708e014952a (diff)
downloadcpython-af5658ae93b0a87ab4420a7dc30a07fa5a83e252.zip
cpython-af5658ae93b0a87ab4420a7dc30a07fa5a83e252.tar.gz
cpython-af5658ae93b0a87ab4420a7dc30a07fa5a83e252.tar.bz2
bpo-34829: Add missing selection_ methods to the Tkinter Spinbox. (GH-9617)
Implement the methods selection_from(), selection_range(), selection_present() and selection_to() for Tkinter Spinbox.
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r--Lib/tkinter/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index ff85f83..25f1ff4 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -3770,6 +3770,24 @@ class Spinbox(Widget, XView):
"""
return self.selection("element", element)
+ def selection_from(self, index):
+ """Set the fixed end of a selection to INDEX."""
+ self.selection('from', index)
+
+ def selection_present(self):
+ """Return True if there are characters selected in the spinbox, False
+ otherwise."""
+ return self.tk.getboolean(
+ self.tk.call(self._w, 'selection', 'present'))
+
+ def selection_range(self, start, end):
+ """Set the selection from START to END (not included)."""
+ self.selection('range', start, end)
+
+ def selection_to(self, index):
+ """Set the variable end of a selection to INDEX."""
+ self.selection('to', index)
+
###########################################################################
class LabelFrame(Widget):