Commit cb6f66d5 by BellCodeEditor

save project

parent a0b409ff
Showing with 65 additions and 10 deletions
#-*- coding:utf-8 -*-
import tkinter
win = tkinter.Tk()
win.geometry("200x100")
win.title('提示')
#
win.mainloop()
\ No newline at end of file
from tkinter import *
class Reg (Frame):
def __init__(self,master):
frame = Frame(master)
frame.pack()
self.lab1 = Label(frame,text = "账户:")
self.lab1.grid(row = 0,column = 0,sticky = W)
self.ent1 = Entry(frame)
self.ent1.grid(row = 0,column = 1,sticky = W)
self.lab2 = Label(frame,text = "密码:")
self.lab2.grid(row = 1,column = 0)
self.ent2 = Entry(frame,show = "*")
self.ent2.grid(row = 1,column = 1,sticky = W)
self.button = Button(frame,text = "登录",command = self.Submit)
self.button.grid(row = 2,column = 1,sticky = E)
self.lab3 = Label(frame,text = "")
self.lab3.grid(row = 3,column = 0,sticky = W)
self.button2 = Button(frame,text = "退出",command = frame.quit)
self.button2.grid(row = 3,column = 3,sticky = E)
def Submit(self):
s1 = self.ent1.get()
s2 = self.ent2.get()
#密码设置
if s1 == 'python' and s2 == '123456':
self.lab3["text"] = "登陆成功"
elif s1 != 'python' and s2 != '123456':
self.lab3["text"] = "用户名和密码错误"
elif s1 != 'python':
self.lab3["text"] = "用户名错误!"
elif d != userpassword:
print('密码错误,请重新输入!')
self.ent1.delete(0,len(s1))
self.ent2.delete(0,len(s2))
root = Tk()
root.title("登录")
app = Reg(root)
root.mainloop()
i = 0
username = "python" # 保存在服务器数据库中的用户账号(正确的账号)
userpassword = "123456" # 保存在服务器数据库中的用户密码(正确的密码)
c = input('请输入账号:')# 请用input()实现用户输入账号、密码的功能
d = input('请输入密码:')
#判断
if c == username and d == userpassword:
print('登录成功!')
else:
print('登录失败!')
# 如果用户输入的账号、密码正确,提示登陆成功
\ No newline at end of file
while True:
c = input('请输入账号:')# 请用input()实现用户输入账号、密码的功能
d = input('请输入密码:')
#判断
if c == username and d == userpassword:
break
elif c != username and d != userpassword:
print('用户名和密码错误,请重新输入!')
elif c != username:
print('用户名不存在,请重新输入!')
elif d != userpassword:
print('密码错误,请重新输入!')
print('登录成功!欢迎来到贝尔编程!')
# 如果用户输入的账号、密码正确,提示登陆成功
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment