五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

今天把好丑的計(jì)算器源碼給你了!

2020-04-27 16:05 作者:1048576_  | 我要投稿

from tkinter import *
from easygui import msgbox
w = Tk()
num1, num2 = IntVar(), IntVar()
flag, equation = StringVar(),StringVar()
def num(n):
? ?global num1,num2
? ?if flag != '':
? ? ? ?num1.set(num1.get()*10+n)
? ?else:
? ? ? ?num2.set(num2.get()*10+n)
? ?equation.set(equation.get() + str(n))
def set_flag(fl):
? ?flag.set(fl)
? ?equation.set(equation.get() + str(fl))
def calculate():
? ?try:
? ? ? ?msgbox(eval(equation.get().replace('×','*').replace('÷','/').replace('^','**')))
? ?except Exception as e:
? ? ? ?msgbox('出現(xiàn)錯誤:'+str(e))
? ?equation.set('')
w.geometry('1000x1000+200+200')
Button(w, text=0, command=lambda: num(0), width=7, height=3, font=('Arial',20)).grid(row=1,column=0)
Button(w, text=1, command=lambda: num(1), width=7, height=3, font=('Arial',20)).grid(row=1,column=1)
Button(w, text=2, command=lambda: num(2), width=7, height=3, font=('Arial',20)).grid(row=1,column=2)
Button(w, text=3, command=lambda: num(3), width=7, height=3, font=('Arial',20)).grid(row=2,column=0)
Button(w, text=4, command=lambda: num(4), width=7, height=3, font=('Arial',20)).grid(row=2,column=1)
Button(w, text=5, command=lambda: num(5), width=7, height=3, font=('Arial',20)).grid(row=2,column=2)
Button(w, text=6, command=lambda: num(6), width=7, height=3, font=('Arial',20)).grid(row=3,column=0)
Button(w, text=7, command=lambda: num(7), width=7, height=3, font=('Arial',20)).grid(row=3,column=1)
Button(w, text=8, command=lambda: num(8), width=7, height=3, font=('Arial',20)).grid(row=3,column=2)
Button(w, text=9, command=lambda: num(9), width=7, height=3, font=('Arial',20)).grid(row=4,column=1)
Button(w, text='+', command=lambda: set_flag('+'), width=7, height=3, font=('Arial',20)).grid(row=1, column=3)
Button(w, text='-', command=lambda: set_flag('-'), width=7, height=3, font=('Arial',20)).grid(row=2, column=3)
Button(w, text='×', command=lambda: set_flag('×'), width=7, height=3, font=('Arial',20)).grid(row=3, column=3)
Button(w, text='÷', command=lambda: set_flag('÷'), width=7, height=3, font=('Arial',20)).grid(row=4, column=3)
Button(w, text='^', command=lambda: set_flag('^'), width=7, height=3, font=('Arial',20)).grid(row=4, column=2)
Button(w, text='=', command=calculate, width=7, height=3, font=('Arial',20)).grid(row=4,column=0)
Label(w, textvar=equation, font=('Arial',30)).grid(row=0,column=1)
w.title('計(jì)算器')
w.mainloop()

今天把好丑的計(jì)算器源碼給你了!的評論 (共 條)

分享到微博請遵守國家法律
喀喇| 阿克陶县| 新田县| 布拖县| 鄢陵县| 淳安县| 长沙市| 连平县| 驻马店市| 原阳县| 阜新市| 崇仁县| 通州区| 青阳县| 吴堡县| 旺苍县| 呼图壁县| 太湖县| 北京市| 永寿县| 林州市| 赣州市| 临猗县| 额尔古纳市| 福建省| 灵寿县| 宣汉县| 海盐县| 临城县| 廉江市| 民丰县| 嘉兴市| 永平县| 苏州市| 梁河县| 萨迦县| 孝义市| 诸城市| 易门县| 遂川县| 保山市|