tkinter.colorchooser --- Color choosing dialog

Code source : Lib/tkinter/colorchooser.py


Le module tkinter.colorchooser fournit la classe Chooser en tant qu'interface avec la boîte de dialogue native du sélecteur de couleurs. Chooser implémente une fenêtre de dialogue de choix de couleur modale. La classe Chooser hérite de la classe Dialog.

class tkinter.colorchooser.Chooser(master=None, **options)

The class implementing the modal color-choosing dialog. Most applications use the askcolor() convenience function rather than instantiating this class directly.

tkinter.colorchooser.askcolor(color=None, **options)

Show a modal color-choosing dialog and return the chosen color. color is the color selected when the dialog opens. The return value is a tuple ((r, g, b), hexstr), where r, g and b are the red, green and blue components as integers in the range 0–255 and hexstr is the equivalent Tk color string, such as '#ff8000'. If the user cancels the dialog, (None, None) is returned.

Modifié dans la version 3.10: The RGB values in the returned color are now integers in the range 0–255 instead of floats.

Voir aussi

Module tkinter.commondialog

Module de dialogue standard Tkinter