如何使用 .grid 方法将滚动条添加到 tkinter Text Widget

我正在尝试为我的文本小部件创建一个滚动条,但是,我似乎无法 grid() 滚动条,因此滚动条没有出现在文本小部件上。忽略变量 Quote 中的内容,它只是测试数据。


EventScrollBar= tk.Scrollbar(EventChoice)

EventText=tk.Text(EventChoice,height=25,width=50)

EventText.grid(row=3,column=1,columnspan=5)

EventScrollBar.config(command=EventText.yview)

EventText.config(yscrollcommand=EventScrollBar.set)

Quote=("""

...

wd""")

EventText.insert(tk.END,Quote)

EventText.config(state=tk.DISABLED)


慕工程0101907
浏览 517回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python