You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.3 KiB

6 months ago
from register import *
from login import *
6 months ago
import os
def main():
global root
global username_entry, password_entry
root = tk.Tk()
root.title("欢迎来到登陆界面")
root.geometry("300x200")
# 用户名和密码输入框
username_label = tk.Label(root, text="账号:")
username_label.pack()
username_entry = tk.Entry(root)
username_entry.pack()
password_label = tk.Label(root, text="密码:")
password_label.pack()
password_entry = tk.Entry(root, show="*")
password_entry.pack()
# 登录按钮
6 months ago
login_button = tk.Button(root, text="登陆", command=main_0)
6 months ago
login_button.pack()
register_button = tk.Button(root, text="注册", command=register)
register_button.pack()
6 months ago
exit_button = tk.Button(root, text="退出", command=root.destroy)
exit_button.pack()
6 months ago
root.mainloop()
6 months ago
def main_0():
6 months ago
entered_username = username_entry.get()
entered_password = password_entry.get()
# 这里可以添加用户名和密码的验证逻辑
if entered_username == query_user(entered_username).username and entered_password == query_user(entered_username).password:
login_1()
else:
erro_label = tk.Label(root, text="账号或密码错误")
erro_label.pack()
main()