Python Tkinter Double Scrollbar
Question: I am trying to display a bunch of very long labels with a scrollbar frame.

For some reason, I need to set the width and height of each label to a fixed
value.

But in that case, when the `label text` exceeds the `label width` and `label
height` some portion of label is not displayed.

So, I want to add another scrollbar for each label that has longer label text
than the label width and height. Here is what I have tried:

    
    
    from Tkinter import*
    def myfunction(event):
            canvas1.configure(scrollregion=canvas1.bbox("all"),width=300,height=400)
    root=Tk()
    root.wm_geometry("%dx%d+%d+%d" % (500, 500, 5, 5))
    
    data1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    
    frame1=Frame(root)
    frame1.place(x=20,y=20)
    canvas1=Canvas(frame1)
    frame2=Frame(canvas1,bg='white',relief=GROOVE,bd=0,width=1230,height=400)
    scrollbar1=Scrollbar(frame1,orient="vertical",command=canvas1.yview)
    canvas1.configure(yscrollcommand=scrollbar1.set)
    scrollbar1.pack(side="right",fill="y")
    canvas1.pack(side="left")
    canvas1.create_window((0,0),window=frame2,anchor='nw')
    frame2.bind("<Configure>",myfunction)
    
    for i in range(10):
        Label(frame2,text=data1,width=30,height=4,bg='white',relief=GROOVE,bd=1,wraplength=200,anchor=NW,justify=LEFT).grid(row=i,column=1)
    
    root.mainloop()
    

Currently, I have a bunch of labels displayed using grid method on the canvas
that has a scrollbar attached. As you can see, a potion of my data "aaaa..."
is not displayed. Is there anyway I can add a scrollbar to each label boxes? I
don't want to change the size of label box.

Or should I use `Text box` instead of labels?

**\--EDIT--**

This is what I have tried:

    
    
    from Tkinter import*
    def myfunction(event):
            canvas1.configure(scrollregion=canvas1.bbox("all"),width=400,height=200)
    def myfunctionx(event):
            canvas1x.configure(scrollregion=canvas1x.bbox("all"),width=100,height=50)
    root=Tk()
    root.wm_geometry("%dx%d+%d+%d" % (500, 500, 5, 5))
    
    data1="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    
    frame1=Frame(root)
    frame1.place(x=20,y=20)
    canvas1=Canvas(frame1)
    frame2=Frame(canvas1,bg='white',relief=GROOVE,bd=0,width=1230,height=400)
    scrollbar1=Scrollbar(frame1,orient="vertical",command=canvas1.yview)
    canvas1.configure(yscrollcommand=scrollbar1.set)
    scrollbar1.pack(side="right",fill="y")
    canvas1.pack(side="left")
    canvas1.create_window((0,0),window=frame2,anchor='nw')
    frame2.bind("<Configure>",myfunction)
    
    frame1x=Frame(frame1,bg='green',width=100,height=50,bd=1,relief=GROOVE)
    frame1x.place(x=10,y=20)
    canvas1x=Canvas(frame1x,bg='yellow',relief=GROOVE,bd=0,width=100,height=50)
    frame2x=Frame(canvas1x,bg='white',relief=GROOVE,bd=0,width=100,height=50)
    scrollbar1x=Scrollbar(frame1x,orient="vertical",command=canvas1x.yview)
    canvas1x.configure(yscrollcommand=scrollbar1x.set)
    scrollbar1x.pack(side="right",fill="y")
    canvas1x.pack(side="left")
    canvas1x.create_window((0,0),window=frame2x,anchor='nw')
    frame2x.bind("<Configure>",myfunctionx)
    
    for i in range(10):
            Label(frame2x,text=data1,width=20,height=4,bg='white',relief=GROOVE,bd=1,wraplength=200,anchor=NW,justify=LEFT).grid(row=i,column=1)
    
    
    root.mainloop()
    

But instead of adding scrollbar to each label, it puts all labels into 1
scrollbar. Is there any way I can have 1 scrollbar for each label box?
(Assuming I will use looping to create several label boxes.)


Answer: You cannot use a scrollbar to scroll a label.

If you need text that is scrollable, use an Entry or Text widget.

