I know we can add embedded widgets in a Text widget using Text method .window_create().But is it possible to add other widgets onto this embedded widget?
For example, I have a Text widget, I want to add a Frame widget under each line, and would like to use this embedded Frame widget as a container for adding e.g. Label widget to display features and annotations for specific part of the text.
How could I achieve, or is there an alternative way?
Here is some example code:
from tkinter import *
root = Tk()
myText = Text(root)
myText.pack()
text = """ACAACATACGAGCCGGAAGCATAAAG
TGTAAAGCCTGGGGTGCCTAATGAGT
GAGCTAACTCACATTAGGCTGAATTA
GGCGCGCCT"""
mylist = text.splitlines()
for row in range(len(mylist)):
myText.insert('end', mylist[row])
myText.insert("end", '\n')
myText.window_create('end', window=Frame(myText, width=180), stretch=1)
myText.insert("end", '\n')
root.mainloop()
The above code will generate this:
With this example code above, how can I add additional widget (e.g. Labels) on those Frames, so that I can display descriptions on certain fragments of the text.
Thanks for helping!!
