tags, better diff
This commit is contained in:
parent
2b71586c04
commit
d202ad3b05
5 changed files with 100 additions and 58 deletions
14
tutorial.md
14
tutorial.md
|
|
@ -132,8 +132,22 @@ print(area.get("1.0", "end")) # obtenir tout le texte
|
|||
print(area.get("2.0", "8.0")) # le texte de la ligne 2 à la ligne 8
|
||||
area.replace("1.0", "end", "le nouveau texte") # remplacer du texte
|
||||
area.insert("1.0", "le nouveau texte") # insérer du texte
|
||||
area.insert("1.0 +42 chars", "le nouveau texte")
|
||||
area.insert("end -3 lines", "le nouveau texte")
|
||||
```
|
||||
|
||||
Pour mettre en forme certaines parties du texte, on peut utiliser des tags :
|
||||
|
||||
```python
|
||||
area.tag_configure("fond_rouge", background="#ffaaaa")
|
||||
area.tag_configure("insistance", foreground="#008800", underline=True)
|
||||
|
||||
area.insert("1.0", "ce texte sera sur fond rouge", "fond_rouge")
|
||||
text.tag_add("insistance", "1.3", "1.8")
|
||||
```
|
||||
|
||||
[Liste de tous les styles possibles.](https://tcl.tk/man/tcl8.6/TkCmd/text.htm#M43)
|
||||
|
||||
### Barre de défilement
|
||||
|
||||
Certains widgets (`Text`) peuvent défiler avec la molette, mais pour afficher la barre de défilement il faut un widget supplémentaire.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue