python登陆界面制作
时间: 2023-11-24 21:41:54 浏览: 113
要制作Python登录界面,可以使用tkinter模块设计图形界面。设计步骤如下:
1. 导入tkinter模块
2. 创建主窗口window
3. 设计欢迎界面,包括系统名称显示、用户类型选择、用户名及密码输入、登录及退出按钮、欢迎界面等功能
4. 定义相关函数实现按钮的功能,如退出系统、管理员登录、普通用户登录等
5. 设置按钮的位置
6. 运行主窗口
下面是一个简单的示例代码:
import tkinter as tk
# 创建主窗口
window = tk.Tk()
window.title("登录界面")
window.geometry("400x300")
# 欢迎界面设计
def welcome():
winlabel = tk.Label(window, text='请选择用户类型:', fg='black', bg='pink', font=("微软雅黑", 15, 'bold'))
winlabel.place(x=100, y=110)
winlabel.configure(width=20, height=4)
# 按钮设计
bt_logquit = tk.Button(window, text='退出系统', bg='pink', command=usr_sign_quit)
bt_logquit.place(x=200, y=230)
bt_admin_login = tk.Button(window, text='管理员登录', bg='pink', command=admin_log_in)
bt_admin_login.place(x=110, y=180)
bt_user_login = tk.Button(window, text='普通用户登录', bg='pink', command=usr_log_in)
bt_user_login.place(x=270, y=180)
welcome()
window.mainloop()
阅读全文
相关推荐

















