⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.unbind_all ( )
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des méthodes
tkinter.unbind_all ( )
DESCRIPTION.
Supprime la gestion et le traitement d'un événement de tous les controles.
SYNTAXE.
widget.unbind_all ( evenement )
widget ⇨ controle devant être dissocié [ OBLIGATOIRE ]
.unbind_all ( ) ⇨ appel de la méthode [ OBLIGATOIRE ]
evenement ⇨ événement à neutraliser [ OBLIGATOIRE ]
REMARQUES.
evenement doit être écrit en suivant une syntaxe, stricte, précise et invariable selon le type d’événement, que l'on souhaite dissocier du controle. Voir le gestionnaire d'événements des controles pour plus de détails sur cette syntaxe.
Par convention, on utilise la fenêtre créée avec tkinter.Tk ( ) ou tkinter.Toplevel ( ) pour l'utilisation de cette méthode.
Voir aussi : les événements dans tkinter et la classe tkinter.Events ( ) pour des informations détaillées sur la gestion des événements dans tkinter.
EXEMPLE.
import tkinter
LST_Couleurs = [ "black" , "red" , "lime" , "yellow" , "blue" , "magenta" , "cyan" , "white" ]
def FNC_Bouton ( event ) :
kactuel = LST_Couleurs.index ( LAB_Reponse [ "background" ] )
kindex = kactuel + 1 if kactuel < 5 else 0
LAB_Reponse [ "background" ] = LST_Couleurs [ kindex ]
LAB_Reponse [ "foreground" ] = LST_Couleurs [ kindex + 2 ]
LAB_Reponse [ "text" ] = f"{ LAB_Reponse [ 'foreground' ] } \ { LAB_Reponse [ 'background' ] }"
def FNC_Desactiver ( ) :
if BUT_Desactiver [ "text" ] == "Désactiver" :
TKI_Principal.unbind_all ( "<ButtonRelease>" )
BUT_Desactiver [ "text" ] = "Activer"
else :
TKI_Principal.bind_all ( "<ButtonRelease>" , FNC_Bouton )
BUT_Desactiver [ "text" ] = "Désactiver"
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Nulle = tkinter.Button ( TKI_Principal , text = "### Sans action ###" )
BUT_Desactiver = tkinter.Button ( TKI_Principal , text = "Désactiver" , command = FNC_Desactiver )
LAB_Reponse = tkinter.Label ( TKI_Principal , text = "En attente ..." , fg = "lime" , bg = "black" )
TKI_Principal.bind_all ( "<ButtonRelease>" , FNC_Bouton )
LAB_Reponse.pack ( fill = "both" )
for kbouton in range ( 5 ) : tkinter.Button ( TKI_Principal , text = "### ACTION ###" ).pack ( )
BUT_Desactiver.pack ( )
BUT_Quitter.pack ( )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de