How to add border to a button in python for Tkinter?

12,746

as per http://effbot.org/tkinterbook/button.htm:

borderwidth= variable

The width of the button border. The default is platform specific, but is usually 1 or 2 pixels. (borderWidth/BorderWidth)

not to be confused with:

highlightthickness= variable

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

Share:
12,746

Related videos on Youtube

Ana_wtk17
Author by

Ana_wtk17

Updated on June 04, 2022

Comments

  • Ana_wtk17
    Ana_wtk17 almost 2 years
    b1 = Button(tk, text=" ", font=("Consolas 30 bold"), height = 1, width = 4,bg = "white", command=lambda:checker(b1))
    

    What piece of code to I add to this to add a border to the button, as in making it thicker?

    • glls
      glls almost 8 years
      please consider researching a bit more prior to posting a question.
    • shevy
      shevy almost 3 years
      In regards to glls's comment above: SO is useful as a resource for people to find answers to questions, even years later (I just found it because I had PRECISELY the same use case and question). With your statement you have not provided anything useful towards Rory Daulton, as well as other people who may come here to try to find answers. Please refrain from telling other people what to do in this regard. Thank you.
  • Russell Smith
    Russell Smith almost 8 years
    highlightthickness is not the same as a border, it's more like a ring around the button. A border is controlled with borderwidth and relief.