버튼을 누르면 입력된 값을 출력하기
from tkinter import *
root = Tk()
# input 박스 생성
e = Entry(root, width=50, bg="black", fg="white", borderwidth=30, border=1)
e.pack()
# 입력하기 전에 보여주는 input 안의 값
e.insert(0,"Enter Your Name: ")
def myClick():
hello = "Hello "+e.get()
myLabel = Label(root, text=hello)
myLabel.pack()
myButton = Button(root, text="Enter Your Name", padx=50, pady=50, command=myClick)
myButton.pack()
root.mainloop()
출처 : https://www.youtube.com/watch?v=7A_csP9drJw&list=PLCC34OHNcOtoC6GglhF3ncJ5rLwQrLGnV&index=4
'프로그래밍 > python' 카테고리의 다른 글
[tkinter] 03. 버튼 만들기 (0) | 2024.04.13 |
---|---|
[tkinter] 02. 행렬 지정하기(row, column) (0) | 2024.04.13 |
[tkinter] 01. hello 창 띄우기 (0) | 2024.04.13 |
chatGPT API (0) | 2024.04.12 |
파이썬 기초 진행기(수시 업데이트 예정) (0) | 2024.04.11 |
댓글