⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Treeview
tkinter.ttk.Treeview ( ).selection_toggle ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ extension ttk ⇨ Treeview
tkinter.ttk.Treeview ( ).selection_toggle ( )
DESCRIPTION.
Inverse les éléments d'une sélection d'un objet tkinter.ttk.Treeview ( ).
SYNTAXE.
TRV_Tableau.selection_toggle ( )
TRV_Tableau ⇨ instance de tkinter.ttk.Treeview ( ) [ OBLIGATOIRE ]
.selection_toggle ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
EXEMPLE.
import tkinter , tkinter.ttk
def FNC_Inverser ( ) :
TRV_Pays.selection_toggle ( "ca" , "su" , "be" , "fr" , "li" )
LAB_Selection [ "text" ] = TRV_Pays.selection ( )
def FNC_GroupeA ( ) :
TRV_Pays.selection_remove ( "su" , "be" , "li" )
TRV_Pays.selection_add ( "ca" , "fr" )
LAB_Selection [ "text" ] = TRV_Pays.selection ( )
def FNC_GroupeB ( ) :
TRV_Pays.selection_remove ( "ca" , "be" , "fr" )
TRV_Pays.selection_add ( "su" , "li" )
LAB_Selection [ "text" ] = TRV_Pays.selection ( )
def FNC_GroupeC ( ) :
TRV_Pays.selection_set ( "be" )
LAB_Selection [ "text" ] = TRV_Pays.selection ( )
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Inverser = tkinter.Button ( TKI_Principal , text = "Inverver" , command = FNC_Inverser )
BUT_Ajouter = tkinter.Button ( TKI_Principal , text = "Goupe A" , command = FNC_GroupeA )
BUT_Retirer = tkinter.Button ( TKI_Principal , text = "Goupe B" , command = FNC_GroupeB )
BUT_Remplacer = tkinter.Button ( TKI_Principal , text = "Goupe C" , command = FNC_GroupeC )
LAB_Selection = tkinter.Label ( TKI_Principal )
TRV_Pays = tkinter.ttk.Treeview ( TKI_Principal )
TRV_Pays.heading ( "#0" , text = "Pays" )
TRV_Pays.insert ( "" , "end" , "ca" , text = "Canada" )
TRV_Pays.insert ( "" , "end" , "su" , text = "Suisse" )
TRV_Pays.insert ( "" , "end" , "be" , text = "Belgique" )
TRV_Pays.insert ( "" , "end" , "fr" , text = "France" )
TRV_Pays.insert ( "" , "end" , "li" , text = "Liban" )
TRV_Pays.grid ( row = 0 , column = 0 , columnspan = 5 )
BUT_Inverser.grid ( row = 1 , column = 0 )
BUT_Ajouter .grid ( row = 1 , column = 1 )
BUT_Retirer.grid ( row = 1 , column = 2 )
BUT_Remplacer .grid ( row = 1 , column = 3 )
BUT_Quitter.grid ( row = 1 , column = 4 )
LAB_Selection.grid ( row = 2 , column = 0 , columnspan = 5 )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de