我是Python的新手 放置滚动条屏幕时出错
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\JAG\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 1558, in __call__
return self.func(*args)
File "C:\bankatmPython\main.py", line 122, in log_in
create_account_screen()
File "C:\bankatmPython\main.py", line 387, in create_account_screen
scrollbar.pack( side = RIGHT, fill = Y )
File "C:\Users\JAG\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 1999, in pack_configure
+ self._options(cnf, kw))
_tkinter.TclError: cannot use geometry manager pack inside . which already has slaves managed by grid
有人可以让我知道我在下面的代码中做了什么吗?
import tkinter as tk
win = tk.Tk()
scrollbar = Scrollbar(win)
scrollbar.pack( side = RIGHT, fill = Y )
mylist = Listbox(win, yscrollcommand = scrollbar.set ).grid(row=3)
答案 0 :(得分:0)
Thanks Bryan, Here is the solution
scrollbar = Scrollbar(win)
transactionText = Listbox(win, yscrollcommand = scrollbar.set )
transactionText.grid(row =0, column=0)
for line in range(100):
transactionText.insert(END, "This is line number " + str(line))
scrollbar.grid(sticky=E, row = 0, rowspan =10, column = 11, ipady = 1000)