What do I need: create Text widgets on every tab.
My code right now:
for i in range(len(result)):
tab[i] = ttk.Frame(tabControl)
tabControl.add(tab[i], text=i)
tabControl.pack(fill='both', expand=True)
for i in range(len(result)):
textwrite[i] = Text(tab[i])
textwrite[i].pack(fill='both', expand=True)
scrollbar_fortext[i] = Scrollbar(tab[i], orient='vertical', command=textwrite[i].yview)
scrollbar_fortext[i].pack(fill='both', expand=True, sticky=NS)
Expected behavior: every tab has a Text widget.
Received behavior:
NameError: name 'textwrite' is not defined
Use a
dictif you want to declare dynamic variable. As your code is not complete, I've kept len(result) as 5. Change the code according to your requirement. The options for '-sticky' are only -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side. There is no option such as NS. So, I've removed that. Change accordingly. This is how the code should be.