⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Scrollbar
tkinter.Scrollbar ( ).identify ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ Scrollbar
tkinter.Scrollbar ( ).identify ( )
DESCRIPTION.
Retourne l'élément d'une barre de défilement présent aux coordonnées indiquées.
SYNTAXE.
Valeur = BAR_Ascenseur.identify ( abscisse , ordonnee )
Valeur = ⇨ variable qui recevra la valeur [ optionnel ]
BAR_Ascenseur ⇨ instance quelconque de tkinter.Scrollbar ( ) [ 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 et ordonnee doivent être des int ( ) ou float ( ), positifs, nuls ou négatifs exprimés en pixels le long de la glissière.
La méthode tkinter.Scrollbar ( ).identify ( ) retourne un str ( ) pouvant avoir l'une des valeurs suivantes :
- "slider" , pour le curseur ;
- "trough1", pour à gauche du curseur si orient = "horizontal" ou au dessus du curseur si orient = "vertical" ;
- "trough2", pour à droite du curseur si orient = "horizontal" ou au dessous du curseur si orient = "vertical" ;
- "arrow1", pour la flèche à gauche si orient = "horizontal" ou au dessus du curseur si orient = "vertical" ;
- "arrow2", pour la flèche à droite si orient = "horizontal" ou au dessous du curseur si orient = "vertical" ;
- "", les coordonnées sont en dehors de la glissière.
EXEMPLE.
import tkinter
def FNC_Partie ( ) :
kabscisse = TKI_Principal.winfo_pointerx ( ) - BAR_Test.winfo_rootx ( )
kordonnee = TKI_Principal.winfo_pointery ( ) - BAR_Test.winfo_rooty ( )
kelement = BAR_Test.identify ( kabscisse , kordonnee )
LAB_Element [ "text" ] = kelement if kelement != "" else '""'
TKI_Principal.after ( 100 , FNC_Partie )
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BAR_Test = tkinter.Scrollbar ( TKI_Principal , orient = "vertical" )
BOX_Liste = tkinter.Listbox ( TKI_Principal , width = 20 )
LAB_Element = tkinter.Label ( TKI_Principal , text = "---")
for kligne in range ( 25 ) : BOX_Liste.insert ( "end" , f"Ligne { kligne } " )
BAR_Test [ "command" ] = BOX_Liste.yview
BOX_Liste [ "yscrollcommand" ] = BAR_Test.set
BOX_Liste.grid ( row = 0 , column = 0 , sticky = "nesw" )
BAR_Test.grid ( row = 0 , column = 1 , sticky = "nesw" )
LAB_Element.grid ( row = 1 , column = 0 , sticky = "nesw" )
BUT_Quitter.grid ( row = 2 , column = 0 , sticky = "nesw" )
FNC_Partie ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de