# How to put a border around a Frame in Python Tkinter?

TkinterPythonGUI-Programming

To put a border around a Frame in Tkinter, we have to use the highlightbackground and highlightthickeness parameters while creating the Frame. Let's take an example and see how to use these two parameters.

## Steps −

• Import the tkinter library and create an instance of tkinter frame.

• Set the size of the frame using geometry method.

• Create a frame with Frame() method. Highlight the border of the frame with a color, highlightbackground="blue". Then, set the thickness of the border, highlightthickness=2.

• Next, create some widgets inside the frame. In the example, we have placed four checkbuttons and a button inside the frame.

• Finally, run the mainloop of the application window.

## Example

from tkinter import *

top = Tk()
top.geometry("700x350")

frame1 = Frame(top, highlightbackground="blue", highlightthickness=2)

C1 = Checkbutton(frame1, text = "Music", width=200, anchor="w")

C2 = Checkbutton(frame1, text = "Video", width=200, anchor="w")

C3 = Checkbutton(frame1, text = "Songs", width=200, anchor="w")

C4 = Checkbutton(frame1, text = "Games", width=200, anchor="w")
top.mainloop()