import tkinter
#함수와 연동 하기 위한 전역변수
global Msg
global window
window = tkinter.Tk()
#확인 버튼 함수
def confirm():
global Msg
global window
Msg = input_text.get()
#윈도우를 종료한다.
window.quit()
window.title("Input Text")
input_text = tkinter.Entry(window, width=30)
input_text.grid(column=0, row=2)
button = tkinter.Button(window, text="확인", command=confirm)
button.grid(column=1, row=2)
window.mainloop()
#입력받은 메세지 출력
print(Msg)
'파이썬' 카테고리의 다른 글
MoviePy로 비디오 편집하기: 파이썬 초보자를 위한 가이드 (0) | 2024.04.16 |
---|---|
Tkinter 대화 상자 (0) | 2023.05.14 |
파이썬 cv2 설치 시 에러 (0) | 2023.05.10 |
파이썬 에러 - the pillow package is required to use this function. (0) | 2023.05.10 |
Error message: No module named 'openpyxl' 에러 (0) | 2023.05.09 |