Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson17-diy3
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
deecf1ac
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d712c853
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
my_window.py
text.txt
my_window.py
View file @
deecf1ac
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
This diff is collapsed.
Click to expand it.
text.txt
0 → 100644
View file @
deecf1ac
用户名: python
密码: 123456
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment