2017-02-22 56 views
0
from tkinter import * 
root=Tk() 
root.geometry('50x50') 
scrol=Scrollbar(root) 
scrol.pack(side=RIGHT,fill=Y) 
x=Listbox(root,yscrollcommand=scrol.set) 
z=[Checkbutton(x,text=i) for i in range(100)] 
for i in z: 
    x.insert(END,i) 
    i.pack() 
scrol.config(command=x.yview) 
x.pack() 
root.mainloop() 

嗨,大家好我有上面的代碼中的問題,運行此代碼後,不幸的是它僅返回一組數字,而不是checkbuttons集。這個代碼我做錯了什麼Checkbuttons在列表框中的Tkinter

回答

0

你不能插入複選框到列表框中。列表框只能包含文本。

相關問題