⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Treeview
tkinter.ttk.Treeview ( ).identify_row ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Treeview
tkinter.ttk.Treeview ( ).identify_row ( )
DESCRIPTION.
Retourne l'identifiant de l'élément, d'un objet tkinter.ttk.Treeview ( ), à l'ordonnée indiquées.
SYNTAXE.
Valeur = TRV_Tableau.identify_row ( ordonnee )
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
TRV_Tableau ⇨ instance de tkinter.ttk.Treeview ( ) [ OBLIGATOIRE ]
.identify_row ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
ordonnee ⇨ ordonnée du point de référence [ OBLIGATOIRE ]
REMARQUES.
ordonne est un int ( ) ou float ( ), exprimé en pixels, il indique la distance entre le point de référence et la bordure haute d'origine de l'arborescence.
La méthode tkinter.ttk.Treeview ( ).identify_row ( ) retourne un str ( ) contenant l'identifiant de l'élément. L'identifiant d'un élément est la chaine de caractères donnée en troisième argument dans la méthode tkinter.ttk.Treeview ( ).insert ( ).
EXEMPLE.
import tkinter , tkinter.ttk
def FNC_Identification ( ) :
kabscisse = TKI_Principal.winfo_pointerx ( ) - TRV_Pays.winfo_rootx ( )
kordonnee = TKI_Principal.winfo_pointery ( ) - TRV_Pays.winfo_rooty ( )
kmessage = f"Analyse au coordonnées ( { kabscisse } , { kordonnee } ) : \n"
kmessage += f"- nature : { TRV_Pays.identify_element ( kabscisse , kordonnee ) } ; \n"
kmessage += f"- colonne : { TRV_Pays.identify_column ( kabscisse ) } ; \n"
kmessage += f"- ligne : { TRV_Pays.identify_row ( kordonnee ) } ; \n"
kmessage += f"- zone : { TRV_Pays.identify_region ( kabscisse , kordonnee ) } ; \n"
kmessage += f"- identifiant : { TRV_Pays.identify ( 'item' , kabscisse , kordonnee ) }."
TKV_Infos.set ( kmessage )
TKI_Principal.after ( 100 , FNC_Identification )
TKI_Principal = tkinter.Tk ( )
TKV_Infos = tkinter.StringVar ( )
TRV_Pays = tkinter.ttk.Treeview ( TKI_Principal , columns = ( "Capitale" , "Superficie" , "Habitants" , "Continent" ) )
TRV_Pays.heading ( "#0" , text = "Pays" )
TRV_Pays.heading ( "Capitale" , text = "Capitale" )
TRV_Pays.heading ( "Superficie" , text = "Km²" )
TRV_Pays.heading ( "Habitants" , text = "Population" )
TRV_Pays.heading ( "Continent" , text = "Continent" )
TRV_Pays.insert ( "" , "end" , "ca" , text = "Canada" , values = ( "Quebec" , "1 542 056" , "8 485 000" , "Amérique" ) )
TRV_Pays.insert ( "" , "end" , "su" , text = "Suisse" , values = ( "Berne" , "41 285" , "8 544 000" , "Europe" ) )
TRV_Pays.insert ( "" , "end" , "ue" , text = "Union Européenne" )
TRV_Pays.insert ( "" , "end" , "an" , text = "Andorre" , values = ( "Andore La Vielle" , "468" , "77 000" , "Europe" ) )
TRV_Pays.insert ( "" , "end" , "al" , text = "Algerie" , values = ( "Alger" , "2 381 741" , "42 972 000" , "Afrique" ) )
TRV_Pays.insert ( "" , "end" , "ma" , text = "Maroc" , values = ( "Rabat" , "710 850" , "34 314 000" , "Afrique" ) )
TRV_Pays.insert ( "" , "end" , "li" , text = "Liban" , values = ( "Beyrouth" , "10 452" , "6 100 000" , "Asie" ) )
TRV_Pays.insert ( "ue" , "end" , "ue.be" , text = "Belgique" , values = ( "Bruxelles" , "30 688" , "11 476 000" , "Europe" ) )
TRV_Pays.insert ( "ue" , "end" , "ue.fr" , text = "France" , values = ( "Paris" , "632 734" , "67 795 000" , "Europe" ) )
TRV_Pays.insert ( "ue" , "end" , "ue.lu" , text = "Luxembourg" , values = ( "Luxembourg" , "2 586" , "613 000" , "Europe" ) )
TRV_Pays.pack ( )
tkinter.Label ( TKI_Principal , textvariable = TKV_Infos , anchor = "w" , justify = "left" ).pack ( )
tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy ).pack ( )
FNC_Identification ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de