资源简介
设计一个GUI界面的ATM系统,该系统可以实现现实生活中ATM机器的大部分功能,涉及到插卡,退卡,取款,存款等操作。
用户插卡:选择已有卡号,输入密码进行登录。
ATM系统功能:查询余额;
转账:输入乙方银行卡和转账金额;
存款;
流水记录:查询银行卡账单
取款;
退卡。
代码片段和文件信息
import tkinter as tk
from tkinter import ttk
import datetime
import tkinter.messagebox
class Windows:
user_info = {}
def __init__(self master=None):
self.atm = ATM()
self.master = master
self.choose_card()
self.pwd_judge = 0
def choose_card(self):
self.root1 = tk.frame(self.master)
self.root1[‘width‘] = 300
self.root1[‘height‘] = 100
self.lbl1 = tk.Label(self.root1 text=‘银行卡:‘ font=(‘microsoft yahei‘ 10))
self.lbl1.place(x=25 y=30)
self.cbox1 = ttk.Combobox(self.root1)
self.cbox1[‘values‘] = self.atm.choose_card()
self.cbox1.place(x=80 y=32)
self.btn1 = tk.Button(self.root1 text=‘确认‘ font=(‘microsoft yahei‘ 10)
command=lambda: self.confirm(self.cbox1.get()))
self.btn1.place(x=250 y=28)
self.root1.pack()
def confirm(self user):
if user != ‘‘:
self.root1.destroy()
self.root1 = tk.frame(self.master)
self.root1[‘width‘] = 300
self.root1[‘height‘] = 100
self.lbl2 = tk.Label(self.root1 text=‘账户:‘ + user font=(‘microsoft yahei‘ 10))
self.lbl2.place(x=25 y=20)
self.lbl3 = tk.Label(self.root1 text=‘密码:‘ font=(‘microsoft yahei‘ 10))
self.lbl3.place(x=25 y=40)
self.entry1 = tk.Entry(self.root1 show=“*“)
self.entry1.place(x=70 y=40)
self.btn2 = tk.Button(self.root1 text=‘确认‘ font=(‘microsoft yahei‘ 10) width=10
command=lambda: self.T_F(user self.entry1.get()))
self.btn2.place(x=90 y=70)
self.root1.pack()
else:
tkinter.messagebox.showinfo(‘提示‘ ‘请选择卡号!‘)
def T_F(self user pwd):
self.flag = False
for i in self.atm.Card:
if i[‘user‘] == int(user):
Windows.user_info = i
if i[‘pwd‘] == int(pwd):
self.flag = True
break
if self.flag:
self.c_to_f()
elif self.pwd_judge == 2:
tkinter.messagebox.showinfo(‘提示‘ ‘密码错误3次,银行卡冻结至明天!‘)
exit()
else:
self.pwd_judge += 1
tkinter.messagebox.showinfo(‘提示‘ ‘密码错误!你还有{0}次机会‘.format(3 - self.pwd_judge))
def c_to_f(self):
tkinter.messagebox.showinfo(‘提示‘ ‘即将进入atm系统‘)
self.root1.destroy()
self.function_board()
def function_board(self):
if self.root1:
self.root1.destroy()
self.root1 = tk.frame(self.master)
self.root1[‘width‘] = 300
self.root1[‘height‘] = 100
self.buttons = [[“查询余额“ “存款“ “取款“]
[“转账“ “流水记录“ “退卡“]]
for r in range(2):
for c in range(3):
def cmd(key=self.buttons[r][c]):
self.cli - 上一篇:PYTHON的winio
- 下一篇:python GUI井字棋
相关资源
- 易语言python支持库
- Python-BDD100K大规模多样化驾驶视频数据
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
川公网安备 51152502000135号
评论
共有 条评论