728x90
#=======================================
# imports
#=======================================
import tkinter as tk
from tkinter import ttk
# Create instance
win = tk.Tk()
# Add a title
win.title("Python GUI")
# Adding a Label
a_label = ttk.Label(win, text="A label")
a_label.grid(column =0, row =0)
# Button Click Event Function
def click_me() :
action.configure(text = "** I have been Clicked ! **")
a_label.configure(foreground ="red")
a_label.configure(text = " A red Label")
action = ttk.Button(win, text = "Click Me !!!", command = click_me)
action.grid(column = 1, row = 0)
#=======================================
# Start GUI
#=======================================
win.mainloop()
클릭시
728x90
'개발자 모드 > 파이썬(python)' 카테고리의 다른 글
파이썬 위젯에 포커스 설정하는 법 (0) | 2022.08.01 |
---|---|
파이썬 버튼 예제 (0) | 2022.08.01 |
파이썬 tkinter GUI 라벨 추가 (0) | 2022.06.30 |
파이썬 GUI size변경 불가 코드 (0) | 2022.06.30 |
파이썬 GUI 인스턴스 만들기 (0) | 2022.06.30 |