⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Font
tkinter.font.Font ( ).cget ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Font
tkinter.font.Font ( ).cget ( )
DEFINITION.
Retourne la valeur d'un des attributs d'un objet fonte.
SYNTAXE.
Valeur = FNT_Fonte.cget ( attribut )
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
FNT_Fonte ⇨ instance quelconque de tkinter.font.Font ( ) [ OBLIGATOIRE ]
.cget ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
attribut ⇨ attribut valide d'un objet fonte [ OBLIGATOIRE ]
Valeur = FNT_Fonte [ attribut ]
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
FNT_Fonte ⇨ instance quelconque de tkinter.font.Font ( ) [ OBLIGATOIRE ]
[ attribut ] ⇨ attribut valide d'un objet fonte [ OBLIGATOIRE ]
REMARQUES.
La méthode tkinter.font.Font.cget ( ) n'est pas native du module tkinter, il faut donc commencer par importer le module tkinter.font pour pouvoir utiliser cette méthode. Voir import pour plus de détails sur l'incorporation de modules, classes et méthodes non built-in dans un script.
attribut doit être un str ( ) correspondant à l'un des attribut des objets fontes : "family", "overstrike", "size", "slant", "underline", "weight".
EXEMPLE.
import tkinter
import tkinter.font
TKI_Principal = tkinter.Tk ( )
FNT_Defaut = tkinter.font.Font ( font = "TkDefaultFont" )
tkinter.Label ( TKI_Principal , text = FNT_Defaut.cget ( "family" ) ).pack ( )
tkinter.Label ( TKI_Principal , text = FNT_Defaut [ "weight" ] ).pack ( )
tkinter.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