Mayan
Mayan

Reputation: 492

Setting borderwidth of a frame doesn't show a border

I follow the tutorials online and the documentations but still can't add a border to a frame. The following is the code I run

import tkinter as tk
root = tk.Tk()

frame1 = tk.Frame(root, borderwidth=2 )
frame2 = tk.Frame(root, borderwidth=2 )
frame1.grid(row = 0)
frame2.grid(row = 1)

tk.Label(frame1, text = 'frame1').grid(row = 0)
tk.Label(frame2, text = 'frame2').grid(row = 0)

root.mainloop()

And this is the result I got. What's the problem? enter image description here

Upvotes: 0

Views: 115

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385890

You need to set the relief option to one of "raised", "sunken", "ridge", or "groove". On your system it appears the default is "flat". The final option is "solid".

examples of tkinter borders

Upvotes: 1

Related Questions