1

I've coded a scrollbar into my app which works like a treat. The only issue is that there is an annoying black frame which apperas around the edges (see below):

The frame I'm talking about is to the right of the scroll bar and above the "Ply builder" title.

My scrollbar code is:

"""Scroll bar"""
        canvas = Canvas(self, borderwidth=0)
        scrollable_frame = Frame(canvas)
        vsb = Scrollbar(self, orient="vertical", command=canvas.yview)
        canvas.configure(yscrollcommand=vsb.set, width=450, height=725)

        vsb.pack(side="right", fill="y")
        canvas.pack(side="left", fill="both", expand=True)
        canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")

        scrollable_frame.bind("<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all")))

Not sure if the border is controlled by the Canvas, Frame or window element. I also don't know how to get rid of it.

pppery
  • 3,731
  • 22
  • 33
  • 46
  • 2
    Add `highlightthickness=0` in `Canvas(...)` – acw1668 Jun 25 '20 at 15:00
  • Does this answer your question? [How do I remove the light grey border around my Canvas widget?](https://stackoverflow.com/questions/4310489/how-do-i-remove-the-light-grey-border-around-my-canvas-widget) – DaVinci Jun 25 '20 at 15:24

1 Answers1

0

As @acw1668 said in the comments,

Add highlightthickness in Canvas(...)

That is the most reasonable solution, and it can be achieved like so:

canvas = Canvas(self, borderwidth=0, highlightthickness = 0)
scrollable_frame = Frame(canvas)
vsb = Scrollbar(self, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand=vsb.set, width=450, height=725)

vsb.pack(side="right", fill="y")
canvas.pack(side="left", fill="both", expand=True)
canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")

scrollable_frame.bind("<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all")))

Read more about the highlightthickness parameter.

The width of the highlight border. The default is system specific (usually one or two pixels). (highlightThickness/HighlightThickness)

Hope this helps!

10 Rep
  • 2,217
  • 7
  • 19
  • 33