我试图在tkinter的画布中添加水平滚动条。这就是我所做的(从本教程中删除 - http://www.tutorialspoint.com/python/tk_scrollbar.htm):
from Tkinter import *
root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill=Y )
mylist = Canvas(root, yscrollcommand = scrollbar.set, scrollregion= (0, 0, 5000, 5000))
for line in range(100):
Label(mylist, text= "This is line number %s" %str(line)).pack()
mylist.pack( side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )
mainloop()
这是我得到的:
不幸的是,移动滚动条什么都不做。有人可以帮忙解决这个问题吗?