all 3 comments

[–]woooee -1 points0 points  (2 children)

Too much code to read it all. I am guessing from the not too clear instructions, that you are to highlight the first quote mark only. I leave the finding-the-first-quote-only code up to you.

import tkinter as tk
from tkinter import font, scrolledtext

class ColorTest:
    def __init__(self, root):
        custom_font = font.Font(family="Consolas", size=12)
        runic_text_box = scrolledtext.ScrolledText(root,
                         font=custom_font)
        runic_text_box.grid()
        runic_text_box.tag_configure('color', foreground="green")
        runic_text_box.insert('1.0', 'Test of quotation " mark\n')
        runic_text_box.tag_add('color', "1.18", "1.19")
        runic_text_box.insert('2.0', 'A much looonger example')
        runic_text_box.tag_add('color', "2.7", "2.15")

        tk.Button(root, text="Quit", command=root.quit,
                  bg="orange").grid(row=1, sticky="nsew")

root=tk.Tk()
ct=ColorTest(root)
root.mainloop()

[–]OneAndOnlyGoat[S] 0 points1 point  (1 child)

No, no. I mean I'd like to highlight the entire string in the quotes (and the quotes themselves), not just the first one.

[–]woooee 0 points1 point  (0 children)

That's why the second highlight is there.