from tkinter import *
from tkinter import ttk
# Tkinter 인스턴스 생성
win = Tk()
# Window 사이즈 지정
win.geometry("700x350")
# 폰드 변경 함수 정의
def font_change():
text.tag_add("start", "1.0", "1.7")
text.tag_configure("start", background="red", foreground="white")
text=Text(win, width=80, height=15, font=('Calibri 12'))
text.insert(INSERT, "Tkinter Text background color change.\n")
text.insert(END, "Learning Tkinter")
text.pack()
# 버튼 생성
ttk.Button(win, text="Text Highlight", command=font_change).pack(pady=20)
win.mainloop()
댓글
댓글 쓰기