2

My setting for the style of scrollbar only works when it's active--that means the text is long enought for the scrollbar to scroll,if not,the style will turn back to DEFAULT and i don't know how to change its style.code and images are shown below

savearea_canvas = tk.Canvas(savearea, borderwidth=0, highlightthickness=0,bg=DLGcolor)

style = ttk.Style()
style.theme_use('default')
style.configure("TScrollbar",
                gripcount=0,
                background=FOCUScolor,
                darkcolor=BGcolor,
                lightcolor=DLGcolor,
                troughcolor=DLGcolor,
                )

savearea_scrollbar = ttk.Scrollbar(savearea, orient='vertical', command=savearea_canvas.yview,style="TScrollbar")
savearea_canvas.configure(yscrollcommand=savearea_scrollbar.set)

savearea_scroll = tk.Frame(savearea_canvas,bg=DLGcolor)
savearea_scroll.bind('<Configure>',lambda e: savearea_canvas.configure(scrollregion=savearea_canvas.bbox('all')))

savearea_canvas.create_window((0, 0), window=savearea_scroll, anchor='nw')
savearea_canvas.configure(yscrollcommand=savearea_scrollbar.set)
savearea_canvas.pack(side='left', fill='both', expand=True)
savearea_scrollbar.pack(side='right', fill='y')

inactive scrollbar active scrollbar

I've tried to read the document but i didn't get anything,and I want to kow how to find all the keywords

TylerH
  • 20,799
  • 66
  • 75
  • 101

0 Answers0