python3 GUI- 登陆界面

python3 GUI- 登陆界面

from tkinter import *

root = Tk()


def Show():
    root1 = Tk()
    if En.get() == 'user' and En1.get() == '123':
        Label(root1, text='登陆成功!', bg='Gold', fg='blue', width=30, height=8, anchor='c').pack()
    else:
        Label(root1, text='用户名或密码错误!', bg='red', fg='blue', width=30, height=8, anchor='c').pack()


label = Label(root, text='用户名:', anchor='c').grid(row=0)
En = Entry(root)
En.grid(row=0, column=1)

label1 = Label(root, text='密码  :', anchor='c').grid(row=1)
En1 = Entry(root, show='*')
En1.grid(row=1, column=1)

Button(root, text='退出', anchor='c', width=6, height=1, command=root.quit).grid(row=2, column=0)
Button(root, text='确定', anchor='c', width=6, height=1, command=Show).grid(row=2, column=1)

root.mainloop()

执行结果:

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值