⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ liste des attributs
tkinter.ttk.style
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ liste des attributs
tkinter.ttk.style
DESCRIPTION.
Associe, ou retourne, un style de formatage, aspect, à un controle du module d'extension tkinter.ttk.
SYNTAXE.
style = nom
REMARQUES.
nom est un str ( ) quelconque mais valide identifiant un style existant.
L'attribut style est uniquement disponible pour les controles issus du module d'extension tkinter.ttk.
Voir le tutoriel pour plus de détails sur le nommage des styles dans tkinter.ttk.
EXEMPLE.
import tkinter
import tkinter.ttk
TKI_Principal = tkinter.Tk ( )
STY_Theme = tkinter.ttk.Style ( )
STY_Theme.configure ( "chiffre.TButton" , foreground = "orange" , background = "white" )
STY_Theme.configure ( "operation.TButton" , foreground = "blue" , background = "aqua" )
STY_Theme.configure ( "option.TButton" , foreground = "red" , background = "pink" )
STY_Theme.configure ( "stop.option.TButton" , background = "yellow" )
for kchiffre in range ( 10 ) :
tkinter.ttk.Button ( TKI_Principal , text = kchiffre , style = "chiffre.TButton" ).grid ( row = 0 , column = kchiffre )
krang = 0
for koperation in ( "+" , "-" , "x" , "/" , "=" ) :
tkinter.ttk.Button ( TKI_Principal , text = koperation , style = "operation.TButton" ).grid ( row = 1 , column = krang )
krang += 1
krang = 0
for koption in ( "C" , "CC" , "MR" , "MC" , "ME" ) :
tkinter.ttk.Button ( TKI_Principal , text = koption , style = "option.TButton" ).grid ( row = 2 , column = krang )
krang += 1
tkinter.ttk.Button ( TKI_Principal , text = "Temoin" ).grid ( row = 3 , column = 0 )
tkinter.ttk.Button ( TKI_Principal , text = "Quitter" , style = "stop.option.TButton" , command = TKI_Principal.destroy ).grid ( row = 3 , column = 1 )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de