⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ PhotoImage
tkinter.PhotoImage ( ).transparency_get ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ PhotoImage
tkinter.PhotoImage ( ).transparency_get ( )
DESCRIPTION.
Indique si le pixel d'une image polychrome, aux coordonnées indiquées, est transparent.
SYNTAXE.
Valeur = IMG_Image.transparency_get ( abscisse , ordonnee )
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
IMG_Image ⇨ création d'une instance de tkinter.PhotoImage ( ) [ OBLIGATOIRE ]
.transparency_get ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
abscisse ⇨ abscisse du point de référence [ OBLIGATOIRE ]
ordonnee ⇨ ordonnée du point de référence [ OBLIGATOIRE ]
REMARQUES.
abscisse et ordonnee doivent être de int ( ) ou des des float ( ). indiquant le pixel qui doit retourner sa couleur.
La méthode tkinter.PhotoImage ( ).transparency_get ( ) retourne True si le pixel aux coordonnées abscisse, ordonnee est transparent, sinon False.
EXEMPLE.
import tkinter
def FNC_Transparent ( event ) :
LAB_Etat [ "text" ] = IMG_Origine.transparency_get ( event.x , event.y )
TKI_Principal = tkinter.Tk ( )
IMG_Origine = tkinter.PhotoImage ( file = "Logo_ON.gif" )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
LAB_Logo = tkinter.Label ( TKI_Principal , image = IMG_Origine , relief = "solid" , bg = "white" )
LAB_Etat = tkinter.Label ( TKI_Principal, text = "En attente ..." , relief = "solid" , bg = "white" )
LAB_Logo.bind ( "<Button>" , FNC_Transparent )
BUT_Quitter.pack ( )
LAB_Logo.pack ( )
LAB_Etat.pack ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de