Debian Codegraph @

Doc/library/tkinter.colorchooser.rst

raw
1 :mod:`!tkinter.colorchooser` --- Color choosing dialog
2 ======================================================
3
4 .. module:: tkinter.colorchooser
5 :synopsis: Color choosing dialog
6
7 **Source code:** :source:`Lib/tkinter/colorchooser.py`
8
9 --------------
10
11 The :mod:`tkinter.colorchooser` module provides the :class:`Chooser` class
12 as an interface to the native color picker dialog. ``Chooser`` implements
13 a modal color choosing dialog window. The ``Chooser`` class inherits from
14 the :class:`~tkinter.commondialog.Dialog` class.
15
16 .. class:: Chooser(master=None, **options)
17
18 The class implementing the modal color-choosing dialog.
19 Most applications use the :func:`askcolor` convenience function rather than
20 instantiating this class directly.
21
22 .. function:: askcolor(color=None, **options)
23
24 Show a modal color-choosing dialog and return the chosen color.
25 *color* is the color selected when the dialog opens.
26 The return value is a tuple ``((r, g, b), hexstr)``, where ``r``, ``g`` and
27 ``b`` are the red, green and blue components as integers in the range 0–255
28 and *hexstr* is the equivalent Tk color string, such as ``'#ff8000'``.
29 If the user cancels the dialog, ``(None, None)`` is returned.
30
31 .. versionchanged:: 3.10
32 The RGB values in the returned color are now integers in the range 0–255
33 instead of floats.
34
35
36 .. seealso::
37
38 Module :mod:`tkinter.commondialog`
39 Tkinter standard dialog module
40