fytfytf 发表于 2020-7-8 11:09:43

tkinter问题

from tkinter import *

root=Tk()

Label(root,text='请选择出生日期').pack(anchor=W)

s1=Scrollbar(root)
s1.pack(anchor=E,fill=Y)

l1=Listbox(root,yscrollcommand=s1.set)

for i in range(1900,2021):
    l1.insert(END,i)

l1.pack(anchor=W,fill=BOTH)

s1.config(command=l1.yview)



root.mainloop()




怎么才能把这个滚动条放到列表框里,求解{:10_266:}

Twilight6 发表于 2020-7-8 11:20:48


from tkinter import *

root=Tk()

Label(root,text='请选择出生日期').pack(anchor=W)

s1=Scrollbar(root)
s1.pack(side=RIGHT,fill=Y)

l1=Listbox(root,yscrollcommand=s1.set)

for i in range(1900,2021):
    l1.insert(END,i)

l1.pack(side=LEFT,fill=BOTH)

s1.config(command=l1.yview)



root.mainloop()

yhhpf 发表于 2020-7-8 11:29:08

from tkinter import *

root=Tk()

Label(root,text='请选择出生日期').pack(anchor=W)

s1=Scrollbar(root)
s1.pack(side=RIGHT,fill=Y)

l1=Listbox(root,yscrollcommand=s1.set)

for i in range(1900,2021):
    l1.insert(END,i)

l1.pack(side=RIGHT,fill=BOTH)

s1.config(command=l1.yview)

root.mainloop()
页: [1]
查看完整版本: tkinter问题