개발자 모드/파이썬(python)
파이썬 버튼 disable 시키기
인생은직구
2022. 8. 1. 22:21
728x90
import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title("python gui")
def click_me():
action.configure(text ="hello "+ name.get())
ttk.Label(win, text ="Enter a name :").grid(column =0, row =0)
name = tk.StringVar()
name_entered = ttk.Entry(win, width =12, textvariable= name)
name_entered.grid(column =0, row =1)
action = ttk.Button(win, text = "Click me!", command = click_me)
action.grid(column =1, row =1)
action.configure(state = 'disabled')
name_entered.focus()
win.mainloop()
728x90