python 的 Tkinter实现一个简易计算器详解编程语言
2023-06-13 09:20:23 时间
frame.pack()
Button(frame, text="1",command=lambda: callback(1) ).grid(row=0,column=0)
Button(frame, text="2",command=lambda: callback(2) ).grid(row=0,column=1)
Button(frame, text="3",command=lambda: callback(3) ).grid(row=0,column=2)
Button(frame, text="4",command=lambda: callback(4) ).grid(row=1,column=0)
Button(frame, text="5",command=lambda: callback(5) ).grid(row=1,column=1)
Button(frame, text="6",command=lambda: callback(6) ).grid(row=1,column=2)
Button(frame, text="7",command=lambda: callback(7) ).grid(row=2,column=0)
Button(frame, text="8",command=lambda: callback(8) ).grid(row=2,column=1)
Button(frame, text="9",command=lambda: callback(9) ).grid(row=2,column=2)
Button(frame, text="0",command=lambda: callback(0) ).grid(row=3,column=0)
Button(frame, text="+",command=lambda: callback1("+") ).grid(row=3,column=1)
Button(frame, text="-",command=lambda: callback1("-") ).grid(row=3,column=2)
Button(frame, text="*",command=lambda: callback1("*") ).grid(row=4,column=1)
Button(frame, text="/",command=lambda: callback1("/") ).grid(row=4,column=2)
Button(frame, text="=", command=self.say_hi).grid(row=4,column=0)
w = Label(frame1,text="输入结果")
w.pack()
self.e = Entry(frame1)
self.e.pack(padx=5)
w1 = Label(frame1,text="计算结果")
w1.pack()
v = StringVar()
e1 = Entry(frame1, textvariable=v)
v.set("")
self.v = v
e1.pack()
def say_hi(self):
print "hi there, everyone!",self.e.get()
input_str = self.e.get()
self.v.set(cacl(input_str))
app = App(root)
root.mainloop()
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8151.html
cjavapython相关文章
- python教程:用简单的Python编写Web应用程序
- Python实现自动回复_python 微信机器人
- python实现发送邮件详解编程语言
- 汉诺塔Python实现详解编程语言
- python获得两个数组的交集、并集、差集详解编程语言
- python改变图片尺寸详解编程语言
- python写个进程监控的脚本详解编程语言
- python删除源文件中的注释并编译详解编程语言
- python在windows下实现ping操作并接收返回信息详解编程语言
- Python压缩和解压缩文件(zip/unzip)详解编程语言
- python通过openpyxl生成Excel文件详解编程语言
- python实现ftp上传文件详解编程语言
- C++中调用Python脚本详解编程语言
- python_day25_序列化模块详解编程语言
- 为Python的web框架编写前端模版的教程详解编程语言
- Python for循环内部实现的一个sample详解编程语言
- Python关键字参数详解编程语言
- Python&Appium实现滑动引导页进入APP详解编程语言
- python实现lower_bound和upper_bound详解编程语言
- 利用python实现冒泡排序详解编程语言
- 四款后起编程语言能否成功挑战Python的王者地位
- 在Linux系统中使用Python编程语言(linux中python)
- Linux 下 Python 升级:轻松完成升级操作(linux下升级python)
- python用Redis与Python实现大数据收集与分析(redis 联合)