0
我有一些tkinter的問題,我有兩個滾動條,第一個不適合整個框架,採取子幀(f5),這是一個問題,我已經嘗試過創建一個新的框架並改變現有的框架,但我所得到的只是垃圾,我會對滾動條問題提供任何幫助。Tkinter滾動條佔用比預期更多的空間
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#spyder
from Tkinter import *
import tkFileDialog
def curdir():
cdir = tkFileDialog.askdirectory(parent=finestra, initialdir="/home")
v.set(cdir)
#MAIN
finestra = Tk()
finestra.title("Creacio de fitxer comprimit")
f=Frame(finestra)
f.pack(side=TOP)
b=Button(f,text='Escollir directori treball',command=curdir)
b.pack(side=LEFT,anchor=W)
v=StringVar()
v.set("/home")
e1=Entry(f,width=35,textvariable=v)
e1.pack(side=LEFT)
l1=Label(f,text="Fitxers a incorporar al fitxer tar:")
l1.pack(side=TOP,anchor=N,padx=120)
f1=Frame(finestra)
f1.pack(side=TOP,anchor=NW)
l2=Label(f1,text="Llista:")
l2.pack(side=LEFT)
br=Button(f1,text='Reomplir')
br.pack(side=LEFT)
bo=Button(f1,text='Ocultar no seleccionats')
bo.pack(side=LEFT)
bos=Button(f1,text='Ocultar seleccionats')
bos.pack(side=LEFT)
Label(f1,text="\t\tCompresió").pack(side=LEFT)
rb1=Radiobutton(f1,text="cap").pack(side=LEFT)
rb2=Radiobutton(f1,text="gzip",value="gzip").pack(side=LEFT)
rb3=Radiobutton(f1,text="bzip2",value="bzip2").pack(side=LEFT)
rb4=Radiobutton(f1,text="xz",value="xz").pack(side=LEFT)
f2=Frame(finestra)
f2.pack(side=LEFT,anchor=W,pady=0)
scrollbar = Scrollbar(f2)
scrollbar.pack(side=RIGHT,fill="y",expand=False)
listbox = Listbox(f2, bd=0, yscrollcommand=scrollbar.set,width=55)
listbox.pack(side=TOP,anchor=W,fill="both",expand=True)
scrollbar.config(command=listbox.yview)
f3=Frame(finestra)
f3.pack(side=LEFT)
Label(f3,text="Tots:").pack(side=TOP,anchor=W)
tots=Button(f3,text=">>>").pack(side=TOP)
Label(f3,text="Als seleccionats:").pack(side=TOP)
af=Button(f3,text="-->").pack(side=TOP)
qt=Button(f3,text="<--").pack(side=TOP)
Label(f3,text="Tots:").pack(side=TOP,anchor=W)
cap=Button(f3,text="<<<").pack(side=TOP)
f4=Frame(finestra)
f4.pack(side=TOP)
scrollbar = Scrollbar(f4)
scrollbar.pack(side=RIGHT, fill=Y)
listbox = Listbox(f4, bd=0, yscrollcommand=scrollbar.set,width=35)
listbox.pack(side=LEFT,padx=5)
scrollbar.config(command=listbox.yview)
f6=Frame(finestra)
f6.pack(side=TOP,anchor=W,padx=20)
Button(f6,text="Crea").pack(side=LEFT)
Label(f6,text="fitxer tar:").pack(side=LEFT)
f5=Frame(f2)
f5.pack(side=BOTTOM,anchor=W)
Button(f5,text="Sortir").pack(side=BOTTOM,anchor=S)
mainloop()