⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.winfo_screenvisual ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.winfo_screenvisual ( )
DESCRIPTION.
Retourne le type d'encodage des couleurs.
SYNTAXE.
Variable = widget.winfo_screenvisual ( )
Variable = ⇨ variable qui recevra la valeur [ optionnel ]
widget ⇨ controle quelconque de l'interface [ OBLIGATOIRE ]
.winfo_screenvisual ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
REMARQUES.
La méthode tkinter.winfo_screenvisual ( ) retourne un str ( ). La valeur retournée peut être : 'truecolor' pour des couleurs codées en 16 ou 24 bits ou 'pseudocolor' pour un codage sur 8 bits.
Par convention, on utilise la fenêtre créée avec tkinter.Tk ( ) pour l'utilisation de cette méthode.
EXEMPLE.
import tkinter
def FNC_Millimetres ( ) :
LAB_Largeur [ "text" ] = f"{ TKI_Principal.winfo_screenmmwidth ( ) } mm."
LAB_Hauteur [ "text" ] = f"{ TKI_Principal.winfo_screenmmheight ( ) } mm."
def FNC_Pixels ( ) :
LAB_Largeur [ "text" ] = f"{ TKI_Principal.winfo_screenwidth ( ) } px."
LAB_Hauteur [ "text" ] = f"{ TKI_Principal.winfo_screenheight ( ) } px."
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Pixels = tkinter.Button ( TKI_Principal , text = "Pixels" , command = FNC_Pixels )
BUT_millimetres = tkinter.Button ( TKI_Principal , text = "Millimètres" , command = FNC_Millimetres )
LAB_Largeur = tkinter.Label ( TKI_Principal , text = "Largeur" )
LAB_Hauteur = tkinter.Label ( TKI_Principal , text = "Hauteur" )
LAB_Type = tkinter.Label ( TKI_Principal , text = "Type" )
LAB_Type.pack ( )
LAB_Largeur.pack ( )
LAB_Hauteur.pack ( )
BUT_Pixels.pack ( )
BUT_millimetres.pack ( )
BUT_Quitter.pack ( )
LAB_Type [ "text" ] = f"{ TKI_Principal.winfo_screenvisual ( ) }"
FNC_Pixels ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de