-1

It seems that ttk's scrollbar's thumb automatically fills up the whole trough when elements can fit within the view-able area..

Even after I add more elements such that the treeview extends past the view-able area, the scrollbar's thumb still doesn't resize. I've tried updating tk itself but it doesn't seem to work.

self.rmv_tree = ttk.Treeview(self.rmv_frame,height=2, columns=self.tree_columns)
self.rmv_scrollbar = ttk.Scrollbar(self.rmv_frame, orient=tk.VERTICAL,command=self.rmv_tree.yview)
self.rmv_scrollbar.pack(side='right',fill='y')

Some google seems to point this out as a unique problem on windows. Any ideas?

Kai
  • 45
  • 1
  • 8
  • please show us the code. It sounds like you aren't linking the scrollbar to the widget that it is controlling. – Bryan Oakley May 03 '15 at 13:37
  • @BryanOakley I added the code. I don't think I'm doing it wrong though. – Kai May 03 '15 at 15:48
  • What website did you find that says this is a unique problem on windows? That website is incorrect, or you are misinterpreting the website. Perhaps we can contact them to update their page. – Bryan Oakley May 03 '15 at 15:51

1 Answers1

1

Scrollbars and widgets need a two-way connection. The scrollbar must be able to tell the scrollable widget to scroll, and the widget must be able to tell the scrollbar where and how to draw the thumb.

You are not telling the tree widget to update the scrollbar with the information about what part of the tree is visible. Add the following line of code after you create the scrollbar:

self.rmv_tree.configure(yscrollcommand=self.rmv_scrollbar.set)
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • Thanks, that worked. May I know how where did you get your knowledge from? – Kai May 03 '15 at 15:53
  • @Kai: I started using tk with tcl in the 90's, and learned mostly from reading the extensive tk documentation. When I started using tkinter, most of that knowledge transferred over. However, there are plenty of sites that have this information. For example: http://effbot.org/tkinterbook/scrollbar.htm – Bryan Oakley May 03 '15 at 15:55
  • I was actually on that page several times, can't believe I overlooked that bit of code. Thanks again. – Kai May 03 '15 at 16:00