⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.autoseparator
⇨ MENU ⇨ MODULES ⇨ tkinter ⇨ liste des attributs
tkinter.autoseparator
DESCRIPTION.
Précise si les séparateur de la pile d'annulation d'un éditeur de texte sont gérés automatiquement ou non.
SYNTAXE.
autoseparator = booleen
REMARQUES.
booleen est un bool ( ). Si autoseparator = True, les séparateurs sont ajoutés automatiquement à la pile d'annulation des modifications. Si autoseparator = False les séparateurs doivent être gérés par le scripts ou l'utilisateur avec la méthode tkinter.Text ( ).edit_separator ( ) . Pour être pris en compte, l'attribut undo de l'éditeur de texte correspondant doit avoir la valeur True, sinon l'attribut autoseparator est ignoré quelque soit sa valeur.
Voir gestion de l'historique d'annulation des éditeurs de texte pour plus de détails.
EXEMPLE.
import tkinter
def FNC_Annuler ( ) :
TXT_Editeur.edit_undo ( )
def FNC_Automatique ( ) :
if "manuels" in BUT_Gestion [ "text" ] :
BUT_Gestion [ "text" ] = "Séparateurs automatiques"
TXT_Editeur [ "autoseparators" ] = False
BUT_Separateur [ "state" ] = "normal"
else :
BUT_Gestion [ "text" ] = "Séparateurs manuels"
TXT_Editeur [ "autoseparators" ] = True
BUT_Separateur [ "state" ] = "disabled"
def FNC_Autoriser ( ) :
if "Interdire" in BUT_Activer [ "text" ] :
BUT_Activer [ "text" ] = "Autoriser les annulations"
TXT_Editeur [ "undo" ] = False
else :
BUT_Activer [ "text" ] = "Interdire les annulations"
TXT_Editeur [ "undo" ] = True
def FNC_Retablir ( ) :
TXT_Editeur.edit_redo ( )
def FNC_Separateur ( ) :
TXT_Editeur.edit_separator ( )
TKI_Principal = tkinter.Tk ( )
BUT_Quitter = tkinter.Button ( TKI_Principal , text = "Quitter" , command = TKI_Principal.destroy )
BUT_Annuler = tkinter.Button ( TKI_Principal , text = "Annuler les modifications" , command = FNC_Annuler )
BUT_Retablir = tkinter.Button ( TKI_Principal , text = "Rétablir les modifications" , command = FNC_Retablir )
BUT_Activer = tkinter.Button ( TKI_Principal , text = "Interdire les annulations" , command = FNC_Autoriser )
BUT_Gestion = tkinter.Button ( TKI_Principal , text = "Séparateurs manuels" , command = FNC_Automatique )
BUT_Separateur = tkinter.Button ( TKI_Principal , text = "Placer un séparateur" , command = FNC_Separateur )
TXT_Editeur = tkinter.Text ( TKI_Principal , undo = True , autoseparators = True , maxundo = 25 , width = 25 , height = 8 )
TXT_Editeur.pack ( )
BUT_Annuler.pack ( fill = "both" )
BUT_Retablir.pack ( fill = "both" )
BUT_Activer.pack ( fill = "both" )
BUT_Gestion.pack ( fill = "both" )
BUT_Separateur.pack ( fill = "both" )
BUT_Quitter.pack ( fill = "both" )
BUT_Separateur [ "state" ] = "disabled"
TXT_Editeur.insert ( "1.0" , "Python est un langage de programmation puissant et facile à apprendre." )
TXT_Editeur.insert ( "end + 1 line" , "\n\n" )
TXT_Editeur.insert ( "end + 1 line" , "Python is an easy to learn, powerful programming language." )
TKI_Principal.mainloop ( )
Votre aide est précieuse pour améliorer ce site, alors n'hésitez pas à faire part de