summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAlan D Moore <me@alandmoore.com>2018-02-09 00:03:55 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-02-09 00:03:55 (GMT)
commita48e78a0b7761dd74f1d03fc69e0f6caa6f02fe6 (patch)
tree4aa85cc74c32fed151a62a1c5da09e27e2583d7a /Doc
parent32921f90821ab54ffb757b7e996e5b7a71fac25e (diff)
downloadcpython-a48e78a0b7761dd74f1d03fc69e0f6caa6f02fe6.zip
cpython-a48e78a0b7761dd74f1d03fc69e0f6caa6f02fe6.tar.gz
cpython-a48e78a0b7761dd74f1d03fc69e0f6caa6f02fe6.tar.bz2
bpo-32585: Add tkinter.ttk.Spinbox. (#5221)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/tkinter.ttk.rst91
-rw-r--r--Doc/whatsnew/3.7.rst6
2 files changed, 92 insertions, 5 deletions
diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst
index 9c0c4cd..5ba31fe 100644
--- a/Doc/library/tkinter.ttk.rst
+++ b/Doc/library/tkinter.ttk.rst
@@ -66,13 +66,13 @@ for improved styling effects.
Ttk Widgets
-----------
-Ttk comes with 17 widgets, eleven of which already existed in tkinter:
+Ttk comes with 18 widgets, twelve of which already existed in tkinter:
:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`,
:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`,
-:class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`. The other six are
-new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`,
-:class:`Separator`, :class:`Sizegrip` and :class:`Treeview`. And all them are
-subclasses of :class:`Widget`.
+:class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, and :class:`Spinbox`.
+The other six are new: :class:`Combobox`, :class:`Notebook`,
+:class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` and
+:class:`Treeview`. And all them are subclasses of :class:`Widget`.
Using the Ttk widgets gives the application an improved look and feel.
As discussed above, there are differences in how the styling is coded.
@@ -381,6 +381,87 @@ ttk.Combobox
Sets the value of the combobox to *value*.
+Spinbox
+-------
+The :class:`ttk.Spinbox` widget is a :class:`ttk.Entry` enhanced with increment
+and decrement arrows. It can be used for numbers or lists of string values.
+This widget is a subclass of :class:`Entry`.
+
+Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`,
+:meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate`
+and :meth:`Widget.state`, and the following inherited from :class:`Entry`:
+:meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`,
+:meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview`,
+it has some other methods, described at :class:`ttk.Spinbox`.
+
+Options
+^^^^^^^
+
+This widget accepts the following specific options:
+
+ .. tabularcolumns:: |l|L|
+
++----------------------+------------------------------------------------------+
+| Option | Description |
++======================+======================================================+
+| from | Float value. If set, this is the minimum value to |
+| | which the decrement button will decrement. Must be |
+| | spelled as ``from_`` when used as an argument, since |
+| | ``from`` is a Python keyword. |
++----------------------+------------------------------------------------------+
+| to | Float value. If set, this is the maximum value to |
+| | which the increment button will increment. |
++----------------------+------------------------------------------------------+
+| increment | Float value. Specifies the amount which the |
+| | increment/decrement buttons change the |
+| | value. Defaults to 1.0. |
++----------------------+------------------------------------------------------+
+| values | Sequence of string or float values. If specified, |
+| | the increment/decrement buttons will cycle through |
+| | the items in this sequence rather than incrementing |
+| | or decrementing numbers. |
+| | |
++----------------------+------------------------------------------------------+
+| wrap | Boolean value. If ``True``, increment and decrement |
+| | buttons will cycle from the ``to`` value to the |
+| | ``from`` value or the ``from`` value to the ``to`` |
+| | value, respectively. |
++----------------------+------------------------------------------------------+
+| format | String value. This specifies the format of numbers |
+| | set by the increment/decrement buttons. It must be |
+| | in the form "%W.Pf", where W is the padded width of |
+| | the value, P is the precision, and '%' and 'f' are |
+| | literal. |
++----------------------+------------------------------------------------------+
+| command | Python callable. Will be called with no arguments |
+| | whenever either of the increment or decrement buttons|
+| | are pressed. |
+| | |
++----------------------+------------------------------------------------------+
+
+
+Virtual events
+^^^^^^^^^^^^^^
+
+The spinbox widget generates an **<<Increment>>** virtual event when the
+user presses <Up>, and a **<<Decrement>>** virtual event when the user
+presses <Down>.
+
+ttk.Spinbox
+^^^^^^^^^^^^
+
+.. class:: Spinbox
+
+ .. method:: get()
+
+ Returns the current value of the spinbox.
+
+
+ .. method:: set(value)
+
+ Sets the value of the spinbox to *value*.
+
+
Notebook
--------
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 8d4772f..3b4ba6e 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -663,6 +663,12 @@ Added :attr:`sys.flags.dev_mode` flag for the new development mode.
Deprecated :func:`sys.set_coroutine_wrapper` and
:func:`sys.get_coroutine_wrapper`.
+
+tkinter
+-------
+
+Added :class:`tkinter.ttk.Spinbox`.
+
time
----