⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.foreground
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.foreground
DESCRIPTION.
Définit ou retourne la couleur du premier plan (texte) du controle, lorsque le pointeur n'est pas sur lui.
SYNTAXE.
foreground = couleur
fg = couleur
REMARQUES.
couleur doit être un str ( ) représentant une couleur valide. Par défaut couleur vaut "#000000" ("black").
Par exemple pour les couleurs les plus courantes :
- noir :foreground = "black" ;
- rouge : foreground = "red" ;
- vert citron : foreground = "lime" ;
- jaune : foreground = "yellow" ;
- bleu : foreground = "blue" ;
- fushia : foreground = "magenta" ;
- cyan : foreground = "aqua" ;
- blanc : foreground = "white" ;
- marron : foreground = "maroon" ;
- vert : foreground = "green" ;
- bleu marine : foreground = "navy" ;
- olive : foreground = "olive" ;
- violet : foreground = "purple" ;
- sarcelle : foreground = "teal" ;
- gris : foreground = "gray" ;
- argent : foreground = "argent" ;
Le comportement de cet attribut, peut varier selon la combinaison controle / environnement utilisée. Il peut même, dans certain cas, être ignoré. Voir les couleurs avec tkinter pour plus de d'informations sur la désignation des couleurs.
EXEMPLE.
import tkinter
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Quitter.grid ( row = 4 , column = 0 , columnspan = 4 , sticky = "nesw" )
tkinter.Button ( TKI_Principal , text = "Blanc" , foreground = "white" ).grid ( row = 0 , column = 0 )
tkinter.Button ( TKI_Principal , text = "Noir" , foreground = "black" ).grid ( row = 0 , column = 1 )
tkinter.Button ( TKI_Principal , text = "Rouge" , foreground = "red" ).grid ( row = 0 , column = 2 )
tkinter.Button ( TKI_Principal , text = "Vert citron" , foreground = "lime" ).grid ( row = 0 , column = 3 )
tkinter.Button ( TKI_Principal , text = "Bleu" , foreground = "blue" ).grid ( row = 1 , column = 0 )
tkinter.Button ( TKI_Principal , text = "Cyan" , foreground = "aqua" ).grid ( row = 1 , column = 1 )
tkinter.Button ( TKI_Principal , text = "Fushia" , foreground = "magenta" ).grid ( row = 1 , column = 2 )
tkinter.Button ( TKI_Principal , text = "Jaune" , foreground = "yellow" ).grid ( row = 1 , column = 3 )
tkinter.Button ( TKI_Principal , text = "Marron" , foreground = "maroon" ).grid ( row = 2 , column = 0 )
tkinter.Button ( TKI_Principal , text = "Vert" , foreground = "green" ).grid ( row = 2 , column = 1 )
tkinter.Button ( TKI_Principal , text = "Bleu marine" , foreground = "navy" ).grid ( row = 2 , column = 2 )
tkinter.Button ( TKI_Principal , text = "Olive", foreground = "olive" ).grid ( row = 2 , column = 3 )
tkinter.Button ( TKI_Principal , text = "Violet" , foreground = "purple" ).grid ( row = 3 , column = 0 )
tkinter.Button ( TKI_Principal , text = "Sarcelle" , foreground = "teal" ).grid ( row = 3 , column = 1 )
tkinter.Button ( TKI_Principal , text = "Gris" , foreground = "gray" ).grid ( row = 3 , column = 2 )
tkinter.Button ( TKI_Principal , text = "Argent" , foreground = "silver" ).grid ( row = 3 , column = 3 )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de