CamIce
CamIce

Reputation: 419

Tkinter: Scrollbar on root instead of another window

I have a small question. When I apply scrollbar to my Listbox, the scrollbar shows on the right side of the root window instead of the subwindow. Here's my code. I found i t somewhere on the internet & modified to my needs:

list_soft = Listbox(software_list)
s = Scrollbar()
list_soft.pack(side=LEFT, fill=Y)
s.pack(side=RIGHT, fill=Y)
s.config(command=list_soft.yview)
list_soft.config(yscrollcommand=s.set)    

here's link for the image: http://i46.tinypic.com/qqv6t5.png the thing on the screen to the right is a scrollbar (almost not visible, sorry for quality) that should be on my listbox widget.

Anyone know what I am doing wrong?

Upvotes: 1

Views: 350

Answers (1)

Anton Kovalenko
Anton Kovalenko

Reputation: 21507

Scrollbar and listbox should (usually) have the same parent:

list_soft = Listbox(software_list)
s = Scrollbar(software_list)
... and so on...

Upvotes: 2

Related Questions