我想做一个记事本,我已经设法创建了类似的东西,但是当我创建滚动条时,我只能使其显示在底部,并且不知道如何将其固定在右边。像普通的滚动条一样。这是代码:
class Notepad:
scrollbar = Scrollbar(root)
Texto = Text(root,wrap=WORD, width=40, height=10,yscrollcommand=scrollbar.set)
Texto.grid(sticky= N + S + W + E)
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(0,weight=1)
scrollbar.grid(sticky=E)
scrollbar.grid_columnconfigure(0,weight=0)
scrollbar.grid_rowconfigure(0,weight=0)
scrollbar.config(command=Texto.yview)
file = None
答案 0 :(得分:0)
发布此消息后,我立即找到了解决方案。在scrollbar.grid(sticky=E)
行中添加了row = 0和column = 1,并将粘性E更改为N + S。