本文主要是介绍笔记篇-unixS菜单系统半成品(暑假更新),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#模块导入
from colorama import Fore
import time as t
import os
import sys
import webbrowser as w
#登录
def login():global ct.sleep(2)print(Fore.RED+'--------------')print(Fore.RED+'1.管理员登录')print(Fore.RED + '2.访客登录')print(Fore.RED + '3.退出系统')login_choice = input("登录模式:")if login_choice == '1':gl_name = input(str('管理员姓名:'))if gl_name == 'Sun':print(Fore.GREEN + '...OK')print(Fore.RED + '------------------------')t.sleep(1)gl_password = input(str('输入四位英文数字混登录密码:'))if gl_password == 'sy19':t.sleep(2)print(Fore.GREEN + '...OK!')c = 1else:print(Fore.GREEN + '密码错误!')login()elif gl_name == 'Walker':print(Fore.GREEN+'...OK')print(Fore.RED+'------------------------')t.sleep(1)gl_password = input(str('输入登录密码:'))if gl_password == '1234567':t.sleep(2)print(Fore.GREEN + '...OK!')c = 1else:print(Fore.GREEN + '密码错误!')login()else:print(Fore.GREEN+'名称错误!')login()elif login_choice == '2':t.sleep(2)other_login = input('访客姓名:')if other_login == 'Sun':t.sleep(1)print(Fore.GREEN+'您是管理员...')print(Fore.RED)t.sleep(2)gl_password = input(str('输入四位英文数字混合登录密码:'))if gl_password == 'sy19':t.sleep(2)print(Fore.GREEN + '...OK!')c = 1else:print(Fore.LIGHTRED_EX + '密码错误!')sys.exit(0)else:c = 2with open('访客登记表.txt','a') as file:file.write('Name:')file.write(other_login)file.write(' login time: ')file.write(t.strftime('%Y-%m-%d %H:%M:%S'))file.write('\n')t.sleep(1)print(Fore.GREEN+'...OK')elif login_choice == '3':print(Fore.LIGHTGREEN_EX+'正在退出...')t.sleep(1)sys.exit(0)else:t.sleep(1.5)print(Fore.LIGHTRED_EX+'只有三个选项!')login()
#欢迎界面
def welcome_gnu():t.sleep(1)print(Fore.LIGHTGREEN_EX+'-------------------')t.sleep(1)print(Fore.LIGHTGREEN_EX + '***UnixS System***')
#管理员登录主菜单
def gl_main():print(Fore.LIGHTGREEN_EX+'-------------------')print(Fore.LIGHTGREEN_EX + '****系统菜单******')print(Fore.LIGHTGREEN_EX + ' 1.系统简介')print(Fore.LIGHTGREEN_EX + ' 2.浏览器')print(Fore.LIGHTGREEN_EX + ' 3.学习python')print(Fore.LIGHTGREEN_EX + ' 4.游戏')print(Fore.LIGHTGREEN_EX + ' 5.创建文件')print(Fore.LIGHTGREEN_EX + ' 6.回收站')print(Fore.LIGHTGREEN_EX + ' 7.退出系统')main_choice = input(">>>")if main_choice == '1':about_system()elif main_choice == '2':web()elif main_choice == '3':learn_python()elif main_choice == '4':passelif main_choice == '5':passelif main_choice == '6':bin()elif main_choice == '7':t.sleep(1)print(Fore.GREEN+'正在退出...')t.sleep(1.5)sys.exit(0)else:print(Fore.LIGHTRED_EX+'输入错误!')
#访客登录主菜单
def fk_main():print(Fore.LIGHTGREEN_EX + '-------------------')print(Fore.LIGHTGREEN_EX + '****系统菜单******')print(Fore.LIGHTGREEN_EX + ' 1.系统简介')print(Fore.LIGHTGREEN_EX + ' 2.创建文件')print(Fore.LIGHTGREEN_EX + ' 3.回收站')print(Fore.LIGHTGREEN_EX + ' 4.退出系统')fk_choice = input(">>>")if fk_choice == '1':about_system()elif fk_choice == '2':passelif fk_choice == '3':bin()elif fk_choice == '4':t.sleep(1)print(Fore.GREEN + '正在退出...')t.sleep(1.5)sys.exit(0)else:print(Fore.LIGHTRED_EX+'输入有误!')
#定义各个功能
def about_system():t.sleep(1)print(Fore.LIGHTGREEN_EX+'系统名称:unixS')print(Fore.LIGHTGREEN_EX+'创建时间:'+str(os.path.getctime('unixS system.py')))print(Fore.LIGHTGREEN_EX+'系统大小:'+str((os.path.getsize('unixS system.py')))+'字节')t.sleep(2)
def bin():bin_path = input('删除文件名:')if os.path.exists(bin_path):print("文件存在")os.remove(bin_path)else:print("文件不存在")
def web():web = input("输入网址:")w.open(web,new=1)
def learn_python():w.open('https://study.163.com/course/courseMain.htm?share=1&shareId=1141927778&courseId=1209570828&_trace_c_p_k2_=bebc5cb371f941a6b95ebf29ec500b15',new=1)
def mk_file():fn = input('file name:')os.mkdir(fn)
login()
welcome_gnu()
while True:t.sleep(2)if c == 1:gl_main()else:t.sleep(1)t.sleep(2)fk_main()
有些功能还在写,敬请期待。我是那个爱搞人的Sun!
这篇关于笔记篇-unixS菜单系统半成品(暑假更新)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!