Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson04_diy
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
c20bac8a
authored
Mar 04, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
2ffb9ec5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
26 deletions
my_music.py
my_music.py
View file @
c20bac8a
import
pygame
for
i
in
range
(
4
):
from
pygame
import
locals
pass
pygame
.
init
()
# 初始化
# 创建窗口
# 2 8 16 box 进制转换 十进制转2 8 16
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
# 载入图片、资源
bg_img
=
pygame
.
image
.
load
(
'background.png'
)
# 背景图
# 数据交换
play_img
=
pygame
.
image
.
load
(
'play.png'
)
# 播放按钮
stop_img
=
pygame
.
image
.
load
(
'stop.png'
)
# 暂停按钮
# a=1
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
# b=2
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
# a,b=b,a
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 中间logo
#print(a,b)
while
True
:
for
event
in
pygame
.
event
.
get
():
#冒泡排序
????
# d=[1,6,2,4,3]
# 绘制画面
# for i in range(4):
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
# for i in range(4-i):
screen
.
blit
(
stop_img
,
(
270
,
330
))
# 暂停按钮
# if d[i]<d[i+1]:
screen
.
blit
(
logo_img
,
(
170
,
60
))
# 中间logo图
# d[i],d[i+1]=d[i+1],d[i]
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
# a='你好'
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
# #去除引号
# 刷新画面
# eval("print(a)")
???
# # 不换行
# print("aa",end=" ")
# print("aa")
# c=1.23556
# print(round(c,2)) #四舍五入
# print(ord('a'))#字符转编码
# print(chr(97))#编码转字符
# # 去除两侧指定字符
# print('baaaab'.strip('b'))
# 异常处理
# try:
# aa=input("请输入")
# print(aa/2)
# except:
# print("请输入数字")
# 数据转换
# s1="abdcccsadaas"
# print(s1.split()) #['abdcccsadaas']
# print(tuple(s1)) #('a', 'b', 'd', 'c', 'c', 'c', 's', 'a', 'd', 'a', 'a', 's')
# print(set(s1)) #{'a', 'c', 's', 'b', 'd'}
#a=['a','b','c','d','e','f']
#for i in a:
#print(i)
# b={"a":"b","a1":"b1","a2":"b2"}
# for i in b.keys():
# print(i,b[i])
# for i in b.values():
# print(i)
# for k,v in b.items():
# print(k,v)
# for i in range(15,10,-2):
# print(i)
#time
a
,
b
,
c
,
d
=
1
,
2
,
3
,
4
def
aaa
(
a
,
b
):
return
b
,
a
c
,
d
=
aaa
(
a
,
b
)
print
(
a
,
b
)
a1
=
1
a2
=
1
a3
=
0
for
i
in
range
(
3
,
6
):
a3
=
a1
+
a2
a2
=
a3
a1
=
a2
print
(
a3
)
\ 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