Advertisement
here2share

# Tk_select_font_recolor.py

Oct 18th, 2020
2,164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. # Tk_select_font_recolor.py
  2.  
  3. from tkinter import *
  4.  
  5. root = Tk()
  6.  
  7. text = Text(root)
  8. text.insert(INSERT, "Hello, World!\n")
  9. text.insert(END, "This is a phrase.\n")
  10. text.insert(END, "Bye bye...\n")
  11. text.pack(expand=1, fill=BOTH)
  12.  
  13. # adding a tag to a part of text specifying the indices
  14. text.tag_add("start", "1.7", "1.13")
  15. text.tag_config("start", background="blue", foreground="yellow")
  16.  
  17. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement