Tkinter 레이블 위젯은 창에 레이블을 만드는 데 사용됩니다. tkinter.ttk 패키지를 사용하여 위젯의 스타일을 지정할 수 있습니다. Label 위젯의 font-size, font-family 및 font-style의 크기를 조정하려면 font('font-family font style', font-size)의 내장 속성을 사용할 수 있습니다. .
예시
이 예에서는 font-size 및 font-style과 같은 Label 텍스트의 스타일을 수정하는 버튼을 생성합니다.
#Import the required libraries
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the geometry of frame
win.geometry("650x250")
#Define all the functions
def size_1():
text.config(font=('Helvatical bold',20))
def size_2():
text.config(font=('Helvetica bold',40))
#Create a Demo Label to which the changes has to be done
text=Label(win, text="Hello World!")
text.pack()
#Create a frame
frame= Frame(win)
#Create a label
Label(frame, text="Select the Font-Size").pack()
#Create Buttons for styling the label
button1= Button(frame, text="20", command= size_1)
button1.pack(pady=10)
button2= Button(frame, text="40", command=size_2)
button2.pack(pady=10)
frame.pack()
win.mainloop() 출력
위의 코드를 실행하면 레이블 텍스트가 포함된 창이 표시됩니다. 버튼을 사용하여 텍스트 레이블의 글꼴 크기를 변경할 수 있습니다.

이제 Text Label 위젯의 글꼴 크기를 변경하도록 선택합니다.
