# -*- coding: utf-8 -*-
"""
Created on Thu Oct 11 10:27:40 2018
@author: rose
"""
from tkinter import *
def callback():
Label(root, text ="用户登录").grid(row=0,column=0)
Label(root, text ="账号:").grid(row=1,column=0)
Label(root, text ="密码:").grid(row=2,column=0)
v1=StringVar()
v2=StringVar()
e1=Entry(root,textvariable=v1)
e2=Entry(root,textvariable=v2,show="*")
e1.grid(row=1,column=1,padx=10,pady=5)
e2.grid(row=2,column=1,padx=10,pady=5)
Button(root,text="登陆",width=10,command=show).grid(row=3,column=0,sticky=W,padx=10,pady=5)
Button(root,text="退出",width=10,command=root.quit).grid(row=3,column=1,sticky=E,padx=10,pady=5)
b1.destroy()
b2.destroy()
theLabel.destroy()
theButton.destroy()
root.update()
def show():
print("账号:%s"%e1.get())
print("密码:%s"%e2.get())
root=Tk()
root.title("花伴侣")
photo = PhotoImage(file="1.gif")
theLabel =Label(root,
text="欢迎来到花伴侣",
justify=LEFT,
image=photo,
compound=CENTER,
font=("宋体",20),
fg="black",
padx=50)#更改边距,横轴的距离
theLabel.grid(row=0)
theButton=Button(root,text="进入",command=callback)#command命令使得按钮按下去连接command后面相关联的函数
theButton.grid(row=1)
b1=Button(root,text="登陆",width=10,command=show)
b1.grid(row=3,column=0,sticky=W,padx=10,pady=5)
b2=Button(root,text="退出",width=10,command=root.quit)
b2.grid(row=3,column=1,sticky=E,padx=10,pady=5)
mainloop()