zhiqingstudy

Be a young person with knowledge and content

Python tkiner designs a simple login interface, and the effect is shown in the following figure. This is a basic tutorial for tkiner, and I hope it will be helpful to you.

Python tkiner simple login interface design
from tkinter import *
from tkinter import messagebox

def func():
    name = entry_name.get()
    password=entry_password.get()
    print(name)
    print(password)

# 创建窗口
root=Tk()
# 设置窗口标题
root.title('请登录')
# 调整窗口大小+位置
root.geometry("500x200+400+200")
# 添加标签控件并定位
label1 = Label(root,text="账号:",font=("宋体",25),fg="red")
label2=Label(root,text="密码:",font=("宋体",25),fg="red")
# 定位
label1.grid(row=0,column=0)
label2.grid(row=1,column=0)

# 添加输入框
entry_name = Entry(root,font=("宋体",25),fg="red")
entry_name.grid(row=0,column=1)
entry_password=Entry(root,font=("宋体",25),fg="red")
entry_password['show']='*'
entry_password.grid(row=1,column=1)


# 添加点击按钮
button = Button(root,text="确认",font=("宋体",25),fg="blue",command=func)
button.grid(row=2,column=1)

# 显示窗口
root.mainloop()


comment
head sculpture
Code:
Related

Why you shouldn't stay at a job for more than 2 years?

3 harsh facts long-distance relationships

how to keep your girlfriend interested in a long-distance relationship




Unless otherwise specified, all content on this website is original. If the reprinted content infringes on your rights, please contact the administrator to delete it
Contact Email:2380712278@qq.com

Filing number:皖ICP备19012824号