Commit 5a12c366 by BellCodeEditor

auto save

parent 0651e310
Showing with 49 additions and 0 deletions
print(chr(0x61))
\ No newline at end of file
import tkinter import tkinter
def func():
#获得输入框的内容
name = e1.get()
password = e2.get()
print(name , password)
#1.使用tkinter下边的Tk()生成一个用户图形界面
root = tkinter.Tk()
#2.设置一下窗口名字 窗口对象.title(name) name是字符串类型
root.title("注册")
#3.设置窗口大小 窗口对象.geometry('横坐标x纵坐标')该方法会随机出现到一个位置窗口对象.geometry('横坐标x纵坐标+出现的横坐标+出现的纵坐标')
root.geometry('400x320+500+300')
root.resizable(width = False,height = False)
#设置标签 tkinter.Label(窗口对象,显示效果,字体参数,字体颜色,背景颜色,宽度,高度)
#l1 = tkinter.Lable(root,text = "info",font = (字体名称,字体大小),fg = "color",bg = 'color',width = 数字,height = 数字)
l1 = tkinter.Label(root,fg = "red",text = "请输入注册信息",bg = 'green',width = 40,height = 2,font = ("宋体",14))
l1.place(x = 0,y = 0)
#账号的标签
l2 = tkinter.Label(root,fg = "red",text = "注册",width = 8,font = ("宋体",14),bg = "pink")
l2.place(x = 50,y = 80)
#4.设置输入框 使用tkinter.Entry(窗口对象,显示效果 , 背景颜色,可显示字符长度)
#4.设置输入框 使用tkinter.Entry(窗口对象,show = None,bg = "color" ,width = 数字)
#账号输入框
e1 = tkinter.Entry(root,show = None,bg = 'light grey',width = 18)
#5.将e1这个输入框布局到窗口上 输入框对象.place(x = 横坐标,y = 纵坐标)
e1.place(x = 140 , y = 80)
#密码
e2 = tkinter.Entry(root,show = '*',bg = 'white',width = 18)
#5.将e1这个输入框布局到窗口上 输入框对象.place(x = 横坐标,y = 纵坐标)
e2.place(x = 140 , y = 120)
#确认密码
e3 = tkinter.Entry(root,show ='*',bg = 'white',width = 18)
#5.将e1这个输入框布局到窗口上 输入框对象.place(x = 横坐标,y = 纵坐标)
e3.place(x = 140 , y = 160)
#提交按钮 tkinter.Button(窗口对象,text = "info",font = (字体名称,字体大小),command = 函数名)
button = tkinter.Button(root,text = "提交",font = ("宋体",14),command = func)
button.place(x = 150 , y = 250)
#使用界面对象.mainloop()可以使得窗口一直出现
root.mainloop()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment