列表框问题顶部的滚动条

Scrollbar on top of listbox issue

我正在尝试将滚动条元素附加到列表框元素的一侧。

当我尝试将滚动条放在列表框的一侧时,滚动条跳到列表框的顶部。我试着把它网格化并打包。 None 其中似乎有效。

看起来像这样:

代码:

from tkinter import *

class MyApp(Frame):
    def __init__(self, root):
        root.title('My app')
        super().__init__(root)
        self.grid()
        self.createWindow()

    def createWindow(self):
        self.listbox = Listbox(self)
        self.listbox.grid(row=0, column=0)
        self.scrollbar = Scrollbar(self.listbox)
        self.scrollbar.grid(row=0, column=1)

if __name__ == '__main__':
    ma = MyApp(Tk())
    mainloop()


我试图完成的事情无法在 Tkinter 中完成。我尝试使用 Wx 模块,效果很好。