⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ PanedWindow
tkinter.PanedWindow ( ).identify ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ PanedWindow
tkinter.PanedWindow ( ).identify ( )
DESCRIPTION.
Retourne un tuple ( ) identifiant l'élément d'une cellule d'un bandeau de controles, présent aux coordonnées données.
SYNTAXE.
TPL_Valeurs = FRM_Bandeau.identify ( abscisse , ordonnee )
TPL_Valeurs = ⇨ variable qui recevra le tuple ( ) [ optionnel ]
FRM_Bandeau ⇨ instance de tkinter.PanedWindow ( ) [ OBLIGATOIRE ]
.identify ( ) ⇨ 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 est un int ( ) ou float ( ) exprimé en pixels, il indique la distance entre le point de référence et la bordure gauche du bandeau de controles.
ordonne est un int ( ) ou float ( ) exprimé en pixels, il indique la distance entre le point de référence et la bordure haute du bandeau de controles.
La méthode tkinter.PanedWindow ( ).identify ( ) retourne un tuple ( ) de deux éléments :
- le premier élément est un int ( ) correspondant à l'index de la cellule à gauche du composant ;
- le deuxième élément est un str ( ) qui identifie le composant, "sash" pour une ligne ou "handle" pour une poignée.
Si aucun composant ne trouve aux coordonnées du point, tkinter.PanedWindow ( ).identify ( ) retourne une chaine de caractères vide ("")
EXEMPLE.
import tkinter
def FNC_identifier ( ) :
kabscisse = TKI_Principal.winfo_pointerx ( ) - FRM_Bandeau.winfo_rootx ( )
kordonnee = TKI_Principal.winfo_pointery ( ) - FRM_Bandeau.winfo_rooty ( )
kidentiant = FRM_Bandeau.identify ( kabscisse , kordonnee )
LAB_Infos [ "text" ] = f"Au point { kabscisse } x { kordonnee } : { kidentiant }."
TKI_Principal.after ( 100 , FNC_identifier )
TKI_Principal = tkinter.Tk ( )
LAB_Infos = tkinter.Label ( TKI_Principal , text = "En attente ..." )
FRM_Bandeau = tkinter.PanedWindow ( TKI_Principal )
FRM_Bandeau.add ( tkinter.Label ( FRM_Bandeau , text = "\n~ 1 ~\n" ) )
FRM_Bandeau.add ( tkinter.Label ( FRM_Bandeau , text = "~ 2 ~" ) )
FRM_Bandeau.add ( tkinter.Label ( FRM_Bandeau , text = "~ 3 ~" ) )
FRM_Bandeau.add ( tkinter.Label ( FRM_Bandeau , text = "~ 4 ~" ) )
FRM_Bandeau.add ( tkinter.Label ( FRM_Bandeau , text = "~ 5 ~" ) )
FRM_Bandeau.add ( tkinter.Button ( FRM_Bandeau , text = "Quitter" , command = TKI_Principal.destroy ) )
FRM_Bandeau [ "background" ] = "palegreen"
FRM_Bandeau [ "borderwidth" ] = 5
FRM_Bandeau [ "relief" ] = "groove"
FRM_Bandeau [ "showhandle" ] = True
FRM_Bandeau [ "sashpad" ] = 5
FRM_Bandeau [ "sashwidth" ] = 3
FRM_Bandeau [ "sashrelief" ] = "ridge"
FRM_Bandeau.pack ( padx = 5 , pady = 2 )
LAB_Infos.pack ( fill = "both" )
FNC_identifier ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de