码迷,mamicode.com
首页 > 其他好文 > 详细

计算器(丑陋版 and 加法专用版)

时间:2016-08-23 20:34:14      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

from tkinter import *

win = Tk()
win.geometry(500x300+400+300)
win[bg] = #0099ff
win.title(魔方小子)

e = Entry(win)
e.pack()

j = Label(win,text=+)
j.pack()

d = Entry(win)
d.pack()

i = Label(win,text=||)
i.pack()

s = Entry(win)
s.pack()

def fun():
    ej = int(e.get())
    de = int(d.get())
    t = ej + de
    t = str(t)
    s.insert(0,t)

def run():
    e.delete(0,END)
    d.delete(0,END)
    s.delete(0,END)
k = Button(win,text=计算,command=fun)
k.pack()
kb = Button(win,text=清除,command=run)
kb.pack()


win.mainloop()

 

计算器(丑陋版 and 加法专用版)

标签:

原文地址:http://www.cnblogs.com/wumac/p/5800581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!