Been rapid firing questions recently. Hopefully this is the last one pertaining to scrollbars. I have a Text widget that populates over a loop. I want a scrollbar for all of the text fields. With the following implementation, the scrollbar only scrolls the last text field.
fldrs = ['C:\\Program Files\\Telegram\\Downloads',
'C:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads',
'C:\\Users\\All Users\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads',
'C:\\Users\\Default\\Downloads', 'C:\\Users\\MaLonn\\Downloads',
'C:\\Users\\Public\\Downloads']
root = T.Tk()
frm1 = ttk.Frame(root, relief='ridge', borderwidth=2)
frm1.grid()
frm2 = ttk.Frame(root, relief='ridge', borderwidth=2)
frm2.grid(row=1)
lbl1 = ttk.Label(frm1, text='To restore your open folders after'
' Explorer closes, select the windows\nyou have opened from the '
'list below:')
lbl1.grid()
scrb = ttk.Scrollbar(frm2, orient='horizontal')
chkb_dict = {}
i = 2
for f in fldrs:
chkb_dict[f] = T.IntVar()
chkb = ttk.Checkbutton(frm2, variable=chkb_dict[f])
chkb.grid(row=i, column=0)
txt1 = T.Text(frm2, height=1, width=10, wrap='none',
xscrollcommand=scrb.set)
txt1.grid(row=i, column=1)
txt1.insert(T.END, f + '\n')
i += 1
scrb.config(command=txt1.xview)
scrb.grid(row=i + 1, column=1, columnspan=2, sticky='ew')
How do I get the scrollbar to scroll all of the text fields at once?