Please note I am new to Tkinter. I have also looked at text tags, but I am not sure how to apply that in this case.
I would like to change the styling of text based on its location in a list (really a list of lists).
The structure of "results_list" is:
[["header1","entry1"],["header2","entry2"]...]
I would like each "header" to have a different font styling than the entries. I am unsure of how to do this / where to find more info (I have tried reading the documentation, but I could not figure it out). Also note: each entry may have more than one element in it. The GUI I am making is an app with definitions; each header is a dictionary and each entry is a single definition (for some words, there are multiple definitions).
Code so far:
def printDictToFrame(self,results_list):
txt = tk.Text(self.SEARCH_RESULTS_FRAME,width = 34,height=20,pady=5,padx=2,background='#d9d9d9',relief=RIDGE)
txt.place(x=10,y=10)
for r_list in results_list:
header = r_list[0]
entry = r_list[1]
txt.insert(tk.END, "{}\n".format(header.center(25,"*")))
for single_result in entry:
txt.insert(tk.END,single_result+"\n")
I have done a makeshift "header" using .center. If possible, I would like the headers to be centered as well.
To clarify, the text such as "三省堂 スーパー大辞林" should be bold and centered, while the entry underneath should be regular text. This pattern should hold for each header/entry combo.