超级简单的超市水果销售系统--1.0

给大家带来一个简单的超市水果销售系统,功能也是相当的简单, 可以查看水果列表,可以,添加水果到购物车,以及结算。话不多少,直接上代码:

import tkinter as tk
from tkinter import ttkwin = tk.Tk()
win['bg'] = '#BDBDBD'
win.title('超市')
win.geometry('775x750+400+20')tk.Label(win, text='水果很贵超市\n--------------------------------', width=30, fg='orange', bg='#DF3A01', font=('Arial', 20)).pack()# 水果名字
fruit_name = ['西瓜', '苹果', '香蕉', '榴莲', '脐橙', '红枣', '芒果', '哈密瓜']
# 水果价格
fruit_price = [10, 20, 12, 50, 13, 14, 20, 9]# 序号
xu_hao = [1, 2, 3, 4, 5, 6, 7, 8]
# 你的钱
tk.Label(win, text='你有多钱').place(x=540, y=100)
# 你的钱输出框
Money = tk.Entry(win, bd=5, width=10)
Money.place(x=620, y=97)# 序号
tk.Label(win, text='序号').place(x=540, y=180)
# 序号输入框
ent_xuhao = tk.Entry(win, bd=5, width=10)
ent_xuhao.place(x=620, y=177)# 数量
tk.Label(win, text='数量').place(x=540, y=220)
# 数量输入框
ent_quantity = tk.Entry(win, bd=5, width=10)
ent_quantity.place(x=620, y=217)# 购物车输出框
txt_Text = tk.Text(win, bg='#585858', fg='#F7FE2E', width=63,height=20, bd=8)
txt_Text.place(x=20, y=410)# 创建表格
table_head = ('fruit name', 'fruit price', 'xu_hao')
table_main = ttk.Treeview(win, height=8, show='headings', columns=table_head)# 设置表头
table_main.heading('fruit name', text='水果名字')
table_main.heading('fruit price', text='水果价格(美元)')
table_main.heading('xu_hao', text='序号')
# 设置位置
table_main.place(x=20, y=80)
# 设置文字对齐
table_main.column('fruit name', width=200, anchor='center')
table_main.column('fruit price', width=200, anchor='center')
table_main.column('xu_hao', width=60, anchor='center')str_name = '你要购买的水果'
str_price = '你需要支付的金额'
str_rest = '你剩余的金额为'# 查看水果函数
def table():for i in range(len(fruit_price)):table_main.insert('', i, values=(fruit_name[i], fruit_price[i], xu_hao[i]))#语句# sql = "insert into user(name, password) values ('%s', '%s')" % (user_name, user_password)def main():# global str_name, str_pricequantity = int(ent_quantity.get())xuhao = int(ent_xuhao.get())money = int(Money.get())if xuhao < 1 or xuhao > 8:tk.Label(win, text='输入有误,请输入1-8之间的序号').place(x=540, y=260)Total_price = quantity*fruit_price[xuhao-1]if money < Total_price:tk.Label(win, text='大人钱不够!\n请你点击  ''退出''  退出程序!!', width=20, height=10, font=('Arial', 30), bg='black', fg='red').place(x=40, y=100)butt_close = tk.Button(win, text='退出', bd=10, width=15, height=3, command=close)butt_close.place(x=200, y=450)else:txt_Text.insert('end', str_name.ljust(20, '-') + str(fruit_name[xuhao - 1]) + '\n')txt_Text.insert('end', str_price.ljust(19, '-') + str(Total_price) + '(美元)' + '\n')txt_Text.insert('end', str_rest.ljust(20, '-')+str(money-Total_price)+'(美元)'+'\n')txt_Text.insert('end', '欢迎下次光临!')def close():win.destroy()# 展示水果按钮
butt_table = tk.Button(win, text='查看水果', height=2, font=("Arial", 12), width=20, bg='black', fg='pink', command=table)
butt_table.place(x=160, y=280)
# 结算按钮
butt_main = tk.Button(win, text='结算', height=2, font=("Arial", 12), width=20, bg='black', fg='orange', command=main)
butt_main.place(x=540, y=450)# 购物车标题
tk.Label(win, text='购物车\n-----------------------------------', font=('Arial', 15), bg='lightgreen', fg='yellow').place(x=130, y=350)win.mainloop()

截图:

是不是简单到没有朋友,因为这个版本过于简单,所以后面制作了水果2.0,下期见。

python--超级简单的超市水果销售系统--1.0相关推荐

  1. 计算机毕业设计(17)python毕设作品之鲜花水果销售系统

    项目背景和意义 目的:伴随着互联网技术的不断发展和完善,在人们的生活和工作的各个方面,互联网都有着非常重大的影响.伴随着国内电子商务行业的迅猛发展,消费者现在能够轻松的实现足不出户的,仅仅通过网络购物 ...

  2. java web水果销售系统_基于jsp的水果销售-JavaEE实现水果销售 - java项目源码

    基于jsp+servlet+pojo+mysql实现一个javaee/javaweb的水果销售, 该项目可用各类java课程设计大作业中, 水果销售的系统架构分为前后台两部分, 最终实现在线上进行水果 ...

  3. java计算机毕业设计-智慧农业水果销售系统源码+系统+mysql数据库+lw文档+部署

    java计算机毕业设计-智慧农业水果销售系统源码+系统+mysql数据库+lw文档+部署 java计算机毕业设计-智慧农业水果销售系统源码+系统+mysql数据库+lw文档+部署 本源码技术栈: 项目 ...

  4. JAVA毕业设计-智慧农业水果销售系统计算机源码+lw文档+系统+调试部署+数据库

    JAVA毕业设计-智慧农业水果销售系统计算机源码+lw文档+系统+调试部署+数据库 JAVA毕业设计-智慧农业水果销售系统计算机源码+lw文档+系统+调试部署+数据库 本源码技术栈: 项目架构:B/S ...

  5. java-php-python-ssm蔬菜水果销售系统计算机毕业设计

    java-php-python-ssm蔬菜水果销售系统计算机毕业设计 java-php-python-ssm蔬菜水果销售系统计算机毕业设计 本源码技术栈: 项目架构:B/S架构 开发语言:Java语言 ...

  6. 计算机毕设(附源码)JAVA-SSM基于智慧农业的水果销售系统

    项目运行 环境配置: Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclis ...

  7. java计算机毕业设计智慧农业水果销售系统MyBatis+系统+LW文档+源码+调试部署

    java计算机毕业设计智慧农业水果销售系统MyBatis+系统+LW文档+源码+调试部署 java计算机毕业设计智慧农业水果销售系统MyBatis+系统+LW文档+源码+调试部署 本源码技术栈: 项目 ...

  8. java智慧农业水果销售系统计算机毕业设计MyBatis+系统+LW文档+源码+调试部署

    java智慧农业水果销售系统计算机毕业设计MyBatis+系统+LW文档+源码+调试部署 java智慧农业水果销售系统计算机毕业设计MyBatis+系统+LW文档+源码+调试部署 本源码技术栈: 项目 ...

  9. (附源码)计算机毕业设计SSM基于智慧农业的水果销售系统

    (附源码)计算机毕业设计SSM基于智慧农业的水果销售系统 项目运行 环境配置: Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ Eclispe( ...

最新文章

  1. 京东运营插件_技术中台产品经理必知的那些易混词儿(1):组件、套件、 中间件、插件……...
  2. 【ECSHOP】格式化商品价格
  3. 你想的到想不到的 javascript 应用小技巧方法
  4. JS----click3种方法
  5. 如何在项目启动时就执行某些操作
  6. java外挂源码_2.7 万 Star!Github 项目源码辅助阅读神器
  7. linux mcelog 运行,服务器硬件检测(采用mcelog)
  8. 运行第一个node.js文件
  9. localhost访问容器mysql失败_Docker - Spring Boot应用程序 - 无法访问localhost上的MySql服务器...
  10. 卷积神经网络创建模型
  11. 环回测试能够提供什么信息_X射线无损检测能够提供BGA焊点的重要信息
  12. DH参数例子-SCARA机器人
  13. 百度地图和百度导航冲突问题
  14. 银行存储管理系统oracle,课内资源 - 基于JSP和Oracle实现的志愿服务银行系统
  15. 10个问题说清楚 什么是元宇宙 - 十问元宇宙:如何将抽象的概念具象化?
  16. html控制台 打印 consol,浏览器console.log()打印输出台不显示输出内容……
  17. 【Git】error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was rece
  18. 耶斯莫拉~一起来学集合啊~
  19. 基于云的胜利冲锋队 团队团队展示
  20. drf-路由组件:自动生成Routers路由、 使用方法、视图集中附加action的声明、自动生成路由router的两种方式的URL区别

热门文章

  1. python pygame小游戏_python:利用pygame实现消消乐小游戏
  2. global.asax文件的作用
  3. python中装饰器的作用_如何理解Python装饰器
  4. Southern and Volga Russia Qualifier 2019-2020 gym102348
  5. 爬虫实例:链家网房源数据爬取
  6. 顶象技术获红杉中国A轮投资,解决企业安全风控问题
  7. Linux 软件包下载加速工具:APT Proxy
  8. pythonlicense问题_解决Pynlpir分词License过期问题
  9. Linx进程间通信(IPC)和基本操作。
  10. ios,android,塞班,iOS塞班给力 非Android热门手机搜罗