⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.state
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.state
DESCRIPTION.
Définit ou retourne l'état du controle.
SYNTAXE.
state = etat
REMARQUES.
etat doit être un str ( ) représentant une état valide parmi les suivants :
"actif", le pointeur est sur le controle ;
"disabled", le controle est insensible au pointeur ;
"normal", le pointeur n'est pas sur le controle.
EXEMPLE.
import tkinter
def FNC_Etat ( Q ) :
if Q == "activer" :
BUT_Quitter [ "state" ] = "active"
else :
if BUT_Quitter [ "state" ] == "disabled" :
BUT_Quitter [ "state" ] = "normal"
else :
BUT_Quitter [ "state" ] = "disabled"
LAB_Etat [ "text" ] = BUT_Quitter [ "state" ]
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Actif = tkinter.Button ( TKI_Principal , text = "Activer" , command = lambda : FNC_Etat ( "activer" ) )
BUT_Insensible = tkinter.Button ( TKI_Principal , text = "(dé)Griser" , command = lambda : FNC_Etat ( "griser" ) )
LAB_Etat = tkinter.Label ( TKI_Principal )
LAB_Etat.pack ( fill = "both" )
BUT_Actif.pack ( fill = "both" )
BUT_Insensible.pack ( fill = "both" )
BUT_Quitter.pack ( fill = "both" )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de