How to Set Border in Tkinter Label widget

Border Represent Width of Border. Border Default Value is 2 Pixel. Set The size of Border around the indicator.

Syntax:   bd= "Numeric Number"

Numeric Number will be 1,2,3,4,5,6,....10 Etc.

Example:

from tkinter import *

my_window = Tk()
my_window.title("Label Border")
my_window.config(bg="#B4EEB4")
my_window.geometry("800x350+450+86")

lbl1 = Label(my_window, text="I AM Label Border 1",
font=("Helvetica", 25, "bold"), bd=30) #set border
lbl2= Label(my_window, text="I Am Label Border 2",
font=("Vrinda", 30, "bold"), bg="red", bd=40) #set border

lbl1.pack(pady=20)
lbl2.pack(pady=10)

my_window.mainloop()
 


Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.









Post a Comment

أحدث أقدم