萌新持续关注中。。。
{:5_95:} {:10_254:} {:10_256:} from tkinter import *
from tkinter import ttk
def make_tk():
b2_root=Tk()
b2_root.title('list_all_persons')
tree=ttk.Treeview(b2_root,columns=['1','2','3','4'],show='headings')
tree.grid()
tree.column('1',width=50,anchor='center')
tree.column('2', width=60, anchor='center')
tree.column('3', width=80, anchor='center')
tree.column('4', width=100, anchor='center')
tree.heading('1',text='name')
tree.heading('2', text='address')
tree.heading('3', text='phone')
tree.heading('4', text='email')
for i in range(100):
tree.insert('','end',values = i)
ybar=Scrollbar(b2_root,orient='vertical',command=tree.yview)
ybar.grid(row=0,column=1,sticky='ns')
tree.config(yscrollcommand=ybar.set)
Button(b2_root, text='return', command=b2_root.destroy).grid(sticky=E, padx=5, pady=5)
b2_root.mainloop()
make_tk()
https://s1.ax1x.com/2021/12/09/oWfDtf.png {:10_279:}写的滚动条是对的,但是由于布局位置,控件和控件之间叠加,所以滚动条就在下面了,你可以设定位置过去就行了
ybar.grid(row=0,column=1,sticky='ns')
修改的就是这行参数,行数为0,列数为1,方向为ns {:10_266:} {:10_254:} 也想知道{:10_316:} {:10_254:} {:10_254:} {:9_241:} {:5_103:} {:10_254:}
页:
[1]