Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson17-diy1
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
b6250443
authored
Jul 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
0651e310
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
my_window.py
my_window.py
View file @
b6250443
'''
1.pygame和tkinter的区别
pygame 做的一些游戏 监听事件,利用鼠标或者键盘的反馈进行人机互动
tkinter模块 是创建一个窗口,在窗口上布局 一个一个的控件,来组合成一个窗口
2.如何使用tkinter
2.1导入tkinter 通过关键字import
2.2生成一个窗口(用户图形界面) tkinter.Tk()
2.3设置标题 窗口名.title(标题) 标题是一个字符串类型的数据
2.4设置窗口大小 窗口名.geometry('宽x高+x坐标+y坐标')
2.4.1 x坐标+y坐标 确定在桌面什么位置显示
2.4.2 宽x高决定了我们窗口的大小
2.5让窗口一直显示在桌面上 窗口名.mainloop()
'''
import
tkinter
root
=
tkinter
.
Tk
()
root
.
title
(
'注册'
)
root
.
geometry
(
'400x320+500+300'
)
e1
=
tkinter
.
Entry
(
root
,
show
=
None
,
font
=
(
'宋体'
,
15
),
width
=
20
,
bg
=
'white'
)
e1
.
place
(
x
=
100
,
y
=
80
)
e2
=
tkinter
.
Entry
(
root
,
show
=
None
,
font
=
(
'宋体'
,
15
),
width
=
20
,
bg
=
'white'
)
e2
.
place
(
x
=
100
,
y
=
130
)
e3
=
tkinter
.
Entry
(
root
,
show
=
None
,
font
=
(
'宋体'
,
15
),
width
=
20
,
bg
=
'white'
)
e3
.
place
(
x
=
100
,
y
=
180
)
a
=
tkinter
.
Label
(
root
,
text
=
'欢迎登录 '
,
font
=
(
'宋体'
,
17
),
width
=
40
,
height
=
2
,
bg
=
'silver'
,
fg
=
'black'
)
a
.
place
(
x
=-
10
,
y
=
0
)
b
=
tkinter
.
Button
(
root
,
text
=
'提交'
,
font
=
(
'宋体'
,
12
),
width
=
4
,
height
=
1
,
bg
=
'white'
,
fg
=
'black'
)
b
.
place
(
x
=
180
,
y
=
230
)
root
.
mainloop
()
\ No newline at end of file
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