pythontkinter实现画出计算器界面的示例
这篇文章主要介绍python tkinter实现画出计算器界面的示例,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
成都创新互联主营广陵网站建设的网络公司,主营网站建设方案,app软件开发公司,广陵h5微信小程序定制开发搭建,广陵网站营销推广欢迎广陵等地区企业咨询
需求:设计能计算加法的计算器界面
代码演示:
from tkinter import * # 创建窗体 root = Tk() #添加标题 root.title("求两数之和") root.geometry("700x80") photo = PhotoImage(file = "/Users/yushengtan/Desktop/calc.png") PhotoLabel = Label(root,image = photo).pack(side = LEFT,padx = 10,pady = 5) #文本框 Entry01 = Entry(root,bg = "pink",width = 10,font = ("黑体",20)).pack(side = LEFT,padx = 5,pady = 5) Label_plus = Label(root,text = "+",font = ("黑体",20)).pack(side = LEFT,padx = 5,pady = 5) #文本框 Entry02 = Entry(root,bg = "pink",width = 10,font = ("黑体",20)).pack(side = LEFT,padx = 5,pady = 5) Label_equal = Label(root,text = "=",font = ("黑体",20)).pack(side = LEFT,padx = 5,pady = 5) #文本框 Entry03 = Entry(root,bg = "green",width = 10,font = ("华文黑体",20)).pack(side = LEFT,padx = 5,pady = 5) Button01 = Button(root,text = "计算",width = 10,height = 2,font = ("华文黑体",15)).pack(side = LEFT,padx = 10,pady = 5) # 运行 root.mainloop()
运行效果演示:
以上是python tkinter实现画出计算器界面的示例的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
分享名称:pythontkinter实现画出计算器界面的示例
路径分享:http://ybzwz.com/article/pdchcp.html