⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Style
tkinter.ttk.Style ( ).theme_create ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Style
tkinter.ttk.Style ( ).theme_create ( )
DESCRIPTION.
Créer un nouveau thème.
SYNTAXE.
tkinter.ttk.Style ( ).theme_create ( nom , parent , reglages )
tkinter.ttk.Style ( ).theme_create ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
nom ⇨ identifiant du nouveau thème [ OBLIGATOIRE ]
parent ⇨ identifiant du style modèle [ optionnel ]
reglages ⇨ définition des réglages temporaire [ optionnel ]
REMARQUES.
nom est un str ( ) quelconque mais valide. Si nom existe déjà dans la liste des thèmes existant, Python lèvera une exception.
parent est un str ( ) identifiant un thème existant. Si parent est présent, le nouveau thème sera initialisé avec tous les styles contenus dans parent. Sinon il aura la base de styles par défaut à sa création.
reglages est présent, il doit avoir la même syntaxe que celle de la méthode tkinter.ttk.Style ( ).theme_settings ( ).
Voir le tutoriel sur les styles tkinter.ttk pour plus d'informations.
Voir les généralités sur les styles tkinter.ttk pour plus d'informations.
EXEMPLE.
import tkinter , tkinter.ttk
TKI_Principal = tkinter.Tk ( )
tkinter.ttk.Label ( TKI_Principal , text = "Thèmes au départ :" ).pack ( )
tkinter.ttk.Label ( TKI_Principal , text = tkinter.ttk.Style ( ).theme_names ( ) ).pack ( )
tkinter.ttk.Style ( ).theme_create ( "origine" )
tkinter.ttk.Label ( TKI_Principal , text = "Thèmes après une création :" ).pack ( )
tkinter.ttk.Label ( TKI_Principal , text = tkinter.ttk.Style ( ).theme_names ( ) ).pack ( )
tkinter.ttk.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy ).pack ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de