Python 3.x Python tkinter滚动条没有可滚动的通道。只能通过箭头旋转阴囊

Python 3.x Python tkinter滚动条没有可滚动的通道。只能通过箭头旋转阴囊,python-3.x,tkinter,Python 3.x,Tkinter,正如标题所说。代码: root = tk.Tk() frm2 = ttk.Frame(root, relief='ridge', borderwidth=2) frm2.grid(row=1) scrb = ttk.Scrollbar(frm2, orient=T.HORIZONTAL) txt1 = T.Text(frm2, width=30, wrap=T.NONE, xscrollcommand=scrb.set) for f in fldrs: txt1.insert(T.END

正如标题所说。代码:

root = tk.Tk()
frm2 = ttk.Frame(root, relief='ridge', borderwidth=2)
frm2.grid(row=1)
scrb = ttk.Scrollbar(frm2, orient=T.HORIZONTAL)
txt1 = T.Text(frm2, width=30, wrap=T.NONE, xscrollcommand=scrb.set)
for f in fldrs:
    txt1.insert(T.END, f + '\n')
    i += 1
txt1.grid()
scrb.config(command=txt1.xview)
scrb.grid(row=i + 1, column=0)

我已经做了一些搜索,但我似乎是以画布为例找到了一些东西。我在这里找到了一个很好的图坦卡门,但它对我不起作用。

这是与相同的问题吗?不是。有了这个问题,我无法获得滚动条。有了这个问题,我可以得到一个滚动条,只是它不能正常工作。没有可滚动的频道。滚动的唯一方法是单击滚动条左右两侧的箭头。滚动条实际上正在工作。尝试将
sticky=“ew”
添加到
scrb.grid(…)
。成功了!谢谢你,@acw1668。