⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ IntVar
tkinter.IntVar ( ).set ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ controles standards ⇨ IntVar
tkinter.IntVar ( ).set ( )
DESCRIPTION.
Modifie la valeur d'une variable de controle de type tkinter.IntVar ( ).
SYNTAXE.
TKV_Entier.set ( entier )
TKV_Entier ⇨ instance quelconque de tkinter.IntVar ( ) [ OBLIGATOIRE ]
.set ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
entier ⇨ nouvelle valeur [ OBLIGATOIRE ]
REMARQUE.
entier doit être int ( ) quelconque mais valide.
EXEMPLE.
import tkinter
def FNC_Fond ( *event ) :
kcouleurs = [ "red" , "lime" , "blue" , "yellow" , "aqua" , "magenta" , "white" ]
kindex = kcouleurs.index ( TKI_Principal [ "background" ] ) + 1
if kindex > 6 : kindex = 0
TKI_Principal [ "background" ] = kcouleurs [ kindex ]
TKI_Principal = tkinter.Tk ( )
TKI_Principal [ "background" ] = "white"
TKV_Test = tkinter.IntVar ( )
tkinter.Label ( TKI_Principal , textvariable = TKV_Test ).pack ( )
tkinter.Button ( TKI_Principal , text = "+ 1" , command = lambda : TKV_Test.set ( TKV_Test.get ( ) + 1 ) ).pack ( )
tkinter.Button ( TKI_Principal , text = "- 1" , command = lambda : TKV_Test.set ( TKV_Test.get ( ) - 1 ) ).pack ( )
tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy ).pack ( )
TKV_Test.trace ( "w" , FNC_Fond )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de