Python tkinter scrollbar用在text上面出现问题


from tkinter import *

r=Tk()
r.title('try')

scrollbary=Scrollbar(r,orient=VERTICAL)
scrollbarx=Scrollbar(r,orient=HORIZONTAL)

text=Text(r,wrap=NONE)

scrollbary.pack(side=RIGHT,fill=Y)
scrollbarx.pack(side=BOTTOM,fill=X)

text.pack(side=LEFT,padx=10,pady=10)

scrollbary.config(command=text.yview)
scrollbarx.config(command=text.xview)

text.config(yscrollcommand=scrollbary.set)
text.config(xscrollcommand=scrollbarx.set)


r.mainloop()

运行出来是这样的

img

希望是这样的滚轮

img

你的scrollbary.pack(side=RIGHT,fill=Y) 应该是 side = LEFT吧