Commit deecf1ac by BellCodeEditor

save project

parent d712c853
Showing with 16 additions and 3 deletions
import tkinter
def register():
name = screen_name.
name = screen_name.get()
number = screen_number.get()
print('您的用户名为:'+str(name))
nametext = " "+str(name)+"\n"
numbertext = " "+str(number)+"\n"
with open('text.txt','w',encoding='utf-8') as tt:
tt.write('用户名:'+nametext)
tt.write('密码:'+numbertext)
root = tkinter.Tk() # 创建窗口
root.title('注册') # 标题
root.geometry('400x320+500+300') # 长×宽+x坐标+y坐标
root.resizable(height=False,width=False)
screen_name = tkinter.Entry(root,show='*',font=('宋体',14),bg='light grey',width=18) # 设置名字窗口
screen_name = tkinter.Entry(root,show=None,font=('宋体',14),bg='light grey',width=18) # 设置名字窗口
screen_name.place(x=140,y=80) # 名字窗口的坐标
screen_number = tkinter.Entry(root,show='*',font=('宋体',14),bg='light grey',width=18) # 设置密码窗口
screen_number.place(x=140,y=140) # 密码窗口的坐标
......@@ -22,6 +31,7 @@ text_number.place(x=50,y=140) # 提示位置
text_numbers = tkinter.Label(root, text='确认密码:', font=('宋体', 15),fg="black") # 确认密码
text_numbers.place(x=30,y=200) # 提示位置
button = tkinter.Button()
button = tkinter.Button(root,text='提交',font=(('宋体'),15),bg='green',command=register) # 提交按钮
button.place(x=200,y=240) # 按钮位置
root.mainloop() # 保持运行
\ No newline at end of file
用户名: python
密码: 123456
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