1

スクロールバー付きのリストボックスを作成しようとしていますが、2 つの不都合が見つかりました。

  1. listox が空でもスクロールバーが表示されます。
  2. リストボックスが展開され、画面の全幅を占有しないようにしたい、幅= 50のみ

私のコード:

text=tkinter.Listbox(root,height=10,width=50)
text.bindtags((text, root, "all"))
for i in range(20):
    text.insert(i,i)

scrl = Scrollbar(text, command=text.yview)
text.config(yscrollcommand=scrl.set)
scrl.pack(anchor='center', side = RIGHT, expand=FALSE, fill=BOTH, ipadx=0, ipady=0)
text.pack(anchor='nw',side=TOP, expand=FALSE,padx=10,pady=10,fill=BOTH,ipadx=0,ipady=20)
print (int(text.winfo_width()))

Fill を Y に変更すると、結果が間違っています: http://s6.postimg.org/x0e445ym9/Sin_t_tulo.png

前もって感謝します。

4

0 に答える 0