If you run the following code (on Windows 7, Python 2.6.5), you should see a light border around a black square and some text below it. How do I get rid of that border?

Thanks!

from Tkinter import *    

class App:

    def __init__(self, master):
        #background frame
        self.bgFrame = Frame(master, bg="black", bd=0)
        self.bgFrame.grid()

        #image area
        self.canvas = Canvas(self.bgFrame, width=200, height=200,
                             bd=0, bg="black")
        self.canvas.grid()


        #some filler text
        self.title = Label(self.bgFrame, text="Hi there.", bg="black", fg="white")
        self.title.grid()

root = Tk()
app = App(root)
root.mainloop()

Just a little quirk in Tkinter. Since the canvas has a default border of 2 pixels simply give it a bd=-2 to cancel it.

Just a little quirk in Tkinter. Since the canvas has a default border of 2 pixels simply give it a bd=-2 to cancel it.

Yep, that did it. Thanks vegaseat!

topic might be 10 years old, I think it isn't the padding, seems like setting the highlightthickness = 0 did the job for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.