当前位置: 首页 > news >正文

做团餐 承包食堂的企业网站如何开网页游戏

做团餐 承包食堂的企业网站,如何开网页游戏,投资网站源码,滨州聊城网站建设目录 1.认识Python 2.环境与工具 2.1 python环境 2.2 Visual Studio Code编译 3.登录和注册窗口 3.1 代码构思 3.2 代码实例 3.3 运行结果 4.总结 1.认识Python Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 Python 的设计具有很强的可读…目录 1.认识Python 2.环境与工具 2.1 python环境 2.2 Visual Studio Code编译 3.登录和注册窗口 3.1 代码构思 3.2 代码实例 3.3 运行结果 4.总结 1.认识Python Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 Python 的设计具有很强的可读性相比其他语言经常使用英文关键字或标点符号它具有比其他语言更有特色的语法结构。 2.环境与工具 2.1 python环境 在Windows上使用命令行窗口查看所安装的python版本 python --version 2.2 Visual Studio Code编译 Visual Studio Code是一款由微软开发且跨平台的免费源代码编辑器。该软件以扩展的方式支持语法高亮、代码自动补全、代码重构功能并且内置了命令行工具和Git 版本控制系统。 3.登录和注册窗口 3.1 代码构思 通过定义五个函数实现对磁盘文件的读和写、用户登录判断、注册信息判断、保存以及注册窗口界面的生成。 3.2 代码实例 import tkinter as tk from tkinter import messagebox import pickle import os# 用pickle模块将字典变量进行序列转换并写入文件 def write_file(path, dic):with open(path, wb) as f:pickle.dump(dic, f)def read_file(path):with open(path, rb) as f:dic pickle.load(f)return dic# 判断用户登录时录入的信息是否正确 def login():if os.path.exists(name.pickle):userinfo read_file(name.pickle)else:userinfo {}name txt_name.get()passwd txt_passwd.get()if name in userinfo.keys():if userinfo[name] passwd:messagebox.showinfo(登录成功, 欢迎您 name)else:messagebox.showerror(登录失败, 密码错误)txt_name.set()txt_passwd.set()e_name.focus()else:messagebox.showerror(登录失败, 用户名不存在)# 实现用户注册功能 def reg(regwin, path, name, passwd, passwd2):if passwd ! passwd2:messagebox.showerror(注册失败, 两次输入的密码不一致)returnif os.path.exists(path):userinfo read_file(path)else:userinfo {}if name in userinfo.keys():messagebox.showerror(注册失败, 用户名已存在)returnelse:userinfo.update({name: passwd})write_file(path, userinfo)messagebox.showinfo(注册成功, 欢迎您 name)regwin.destroy()# 生成一个注册窗口界面 def create_regwindow():regwin tk.Toplevel(win)regwin.title(注册)regwin.geometry(300x250)lb_name tk.Label(regwin, text用户名, bggainsboro, font(arial, 12), height1, width10)lb_name.place(x50, y50)lb_passwd tk.Label(regwin, text密码, bggainsboro, font(arial, 12), height1, width10)lb_passwd.place(x50, y100)lb_passwd2 tk.Label(regwin, text确认密码, bggainsboro, font(arial, 12), height1, width10)lb_passwd2.place(x50, y150)txt_name tk.StringVar()e_name tk.Entry(regwin, textvariabletxt_name, font(arial, 12), width15)e_name.place(x150, y50, anchornw)txt_passwd tk.StringVar()e_passwd tk.Entry(regwin, textvariabletxt_passwd, font(arial, 12), show*)e_passwd.place(x150, y100, anchornw)txt_passwd2 tk.StringVar()e_passwd2 tk.Entry(regwin, textvariabletxt_passwd2, font(arial, 12), show*)e_passwd2.place(x150, y150, anchornw)# 生成一个注册按钮btn_reg tk.Button(regwin, text注册, bggainsboro, font(arial, 12), height1, width10, commandlambda: reg(regwin, ./part4/name.pickle, txt_name.get(), txt_passwd.get(), txt_passwd2.get()))btn_reg.place(x100, y200, anchornw)if __name__ __main__:win tk.Tk()win.title(登录)win.geometry(300x200)win[background] gainsborolb_name tk.Label(win, text用户名, bggainsboro, font(arial, 12), height1, width10)lb_name.place(x50, y50, anchornw)lb_passwd tk.Label(win, text密码, bggainsboro, font(arial, 12), height1, width10)lb_passwd.place(x50, y100, anchornw)txt_name tk.StringVar()e_name tk.Entry(win, textvariabletxt_name, font(arial, 12), width15)e_name.place(x150, y50, anchornw)txt_passwd tk.StringVar()e_passwd tk.Entry(win, textvariabletxt_passwd, font(arial, 12), show*)e_passwd.place(x150, y100, anchornw)btn_log tk.Button(win, text登录, bggainsboro, font(arial, 12), height1, width10, commandlogin)btn_log.place(x50, y150, anchornw)btn_reg tk.Button(win, text注册, bggainsboro, font(arial, 12), height1, width10, commandcreate_regwindow)btn_reg.place(x150, y150, anchornw)win.mainloop() 3.3 运行结果 登录 注册以用户名111密码111为例 登录成功 4.总结 通过定义函数实现可视化界面通过利用python库实现信息的交互。
http://www.hkea.cn/news/14456078/

相关文章:

  • 万户信息 做网站怎么样深圳网站建设送域名
  • 目前做网站的公司有哪些江门网站制作方案定制
  • vue cms 网站开发什么建站平台好
  • 广东建网站公司外贸人员招聘信息
  • 用php做的网站怎么上传快速seo软件
  • 合川网站制作wordpress模板免费
  • 网站后台忘记账号密码厦门在哪个网站做用工报备
  • 高校网站建设需求分析报告有没有做线播放网站
  • 门户网站的区别网站建设招标技术要求
  • 网站建设开票单位微信公众账号登录官网
  • 建设银行网站的机构有哪些jsp借书网站开发
  • wordpress 直播网站全自动在线制作网页
  • wordpress数据表前缀seo在线诊断工具
  • 医院网站建设存在问题wordpress获取文章数量
  • 网站页面如何设计企业公司网站模板
  • 做自己的网站给人的启发网络推广主要工作内容
  • 网站建设与熊掌号未来的关系聊城网站那家做的好
  • 网站规划与设计方向免费商标图案 创意
  • 响应式网站的宽度金华网站制作企业
  • 公司建设网站首页国家企业公示平台官网
  • 贵阳百度做网站电话重庆建设工程信息网信息网
  • 做公司网站 找谁做常用的网络营销工具有哪些
  • 做公司网站阿里wordpress 查看全文
  • 做网站英语老师的简历手机网站代理
  • 深圳市珠宝网站建设镇江网站
  • 邯郸网站设计报价wordpress 手机端打开速度慢
  • 不收费推广网站有哪些美团网站建设总体需求与目标
  • 扁平化网站导航ui模板网站费用估算
  • 服务平台app下载上海seo推广服务
  • 襄樊公司网站建设做视频网站怎么看不会卡