How to Manage the Spacing inside Bordered Label in Python Tkinter?

Muhammad Asim :

I have program in which i have made a Bordered label but its bordered is too close to the Text. I want to give spacing between Border and Text of Label. Code is Below.

from tkinter import *
import tkinter as tk

win = Tk()
win.title("Labels")
win.geometry("800x600+50+50")
win.config(bg='white')

label1=Label(win, text="Label with Border.", font=("Calibri",24,"bold"), bg='white', borderwidth=1, relief="solid")
label1.pack(pady=15)

win.mainloop()

Output:

Arun :

Use padx property to adjust the padding in x coordinate

Ex; lab=Label(padx=20) ,will add 20px spacing in left and right side of the label

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=17017&siteId=1