from tkinter import *
def domath():
a = int((entry1.get()))
operator = entry2.get()
b = int((entry3.get()))
if operator == "-":
answer.config(text=str(a-b))
if operator == "*":
answer.config(text=str(a*b))
if operator == "/":
answer.config(text=str(a/b))
if operator == "+":
answer.config(text=str(a+b))
if operator == "**":
answer.config(text=str(a**b))
elif( operator != "-") and (operator != "+") and (operator != "*") and (operator != "/") and (operator != "**"):
answer.config(text="야아 기분좋다!")
entry1.delete(0, END)
entry2.delete(0, END)
entry3.delete(0, END)
def shutdown():
exit()
root = Tk()
root.title("Idiot Caculator")
root.resizable(False, False)
root.geometry("320x500+0+0")
label1 = Label(root, text="계산기")
label1.pack()
label2 = Label(root, text="숫자")
label2.pack()
entry1 = Entry(root, width=100)
entry1.pack()
label3 = Label(root, text="연산자 (* / - + **) 5가지 중 하나 선택")
label3.pack()
entry2 = Entry(root, width=100)
entry2.pack()
label4 = Label(root, text="숫자")
label4.pack()
entry3 = Entry(root, width=100)
entry3.pack()
btn1 = Button(root, text="계산", command=domath)
btn1.pack()
answer = Label(root, text="결과")
answer.pack()
btn1 = Button(root, text="종료", command=shutdown)
btn1.pack()
root.mainloop()
구글링 하면서 만듬
- dc official App
elif가 좆으로 보이냐?
ELIF 가 있었노 - dc App
똥송합니다 - dc App
else좌 elif는 허용이었노? - dc App
ㄴ 파이썬엔 switch 없지 않냐 - dc App
싸가지없는 새끼가 말뽄새봐라
게이야 연산식 계산하게 만들어봐라 - dc App
만들면 념글 ㄱㄴ? - dc App
중2가 만들면 인정이지 ㅋㅋ - dc App
나도 중딩때 인터프리터 만들었었는데 추억돋는다
파이썬말고 러스트는 어때?
니애미