728x90
import tkinter.messagebox as msgbox
from tkinter import *
root =Tk()
root.title(" GUI")
root.geometry("640x480")
def info() :
msgbox.showinfo("알림", "정상적으로 예매 완료 되었습니다.")
def warn() :
msgbox.showwarning("경고", "해당 좌석은 매진되었습니다.")
def error() :
msgbox.showerror("에러", "결재 오류가 발생하였습니다.")
def okcancel() :
msgbox.askokcancel("확인 / 취소", "해당 좌석은 유아동반석입니다. 예매 하시겠습니까?")
def retrycancel() :
response = msgbox.askretrycancel("재시도 / 취소", "일시적인 오류입니다. 다시 시도하시겠습니까?")
if response == 1 :
print("예")
elif response == 0 :
print("아니오")
def yesno() :
msgbox.askyesno("예 / 아니오", "해당 좌석은 역방향입니다. 예매하시겠습니까?")
def yesnocancel() :
response = msgbox.askyesnocancel(title = None, message = "예매 내역이 저장되지 않았습니다. \n저장 후 프로그램을 저장하시겠습니까?")
# 네 : 저장 후 종료
# 아니오 : 저장 하지 않고 종료
# 취소 : 프로그램 종료 취소 (현재 화면에서 계속 작업)
print("응답 :", response) # True, False, None -> 1, 0, 그외
if response == 1 :
print("예")
elif response == 0 :
print("아니오")
else :
print("취소")
Button(root, command = info, text ="알림").pack()
Button(root, command = warn, text ="경고").pack()
Button(root, command = error, text ="에러").pack()
Button(root, command = okcancel, text ="확인 취소").pack()
Button(root, command = retrycancel, text ="재시도 취소").pack()
Button(root, command = yesno, text ="예 아니오").pack()
Button(root, command = yesnocancel, text ="예 아니오 취소").pack()
root.mainloop()
728x90
'개발자 모드 > 파이썬(python)' 카테고리의 다른 글
파이썬 스크롤바 예제소스 (0) | 2021.06.29 |
---|---|
파이썬 프레임 예제소스 (0) | 2021.06.29 |
파이썬 (python) UDP 소스 코드 (0) | 2021.06.26 |
파이썬 시간 모듈 사용법 (0) | 2021.06.25 |
파이썬(python) GPS GPRMC 체크섬(checksum) 구하는 코드 (0) | 2021.06.24 |