Commit 51413712 by BellCodeEditor

auto save

parent 49d841dd
Showing with 14 additions and 1 deletions
...@@ -12,13 +12,26 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -12,13 +12,26 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
#设置音量的初始值volume
volume=0.6
#加载音乐文件 #加载音乐文件
pygame.mixer.music.load("歌曲4.ogg") pygame.mixer.music.load("歌曲4.ogg")
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type==locals.QUIT:#判断事件类型是否为退出事件QUIT???? if event.type==locals.QUIT:#判断事件类型是否为退出事件QUIT????
exit() #结束程序 exit() #结束程序
if event.type==locals.KEYDOWN: #判断事件类型是否为按键按下事件
if event.key==locals.K_UP: #判断是否按下up键
volume+=0.1#声音加0.1
if volume>1:#判断音量是否大于1
volume=1#音量设为1
#设置播放音乐的音量
pygame.mixer.music.set_volume(volume)
#判断是否按下down键
#声音减0.1
#判断音量是否小于0
#音量设为0
#设置播放音乐的音量
if pygame.mixer.music.get_busy()==False: #判断播放器没有正在播放音乐 if pygame.mixer.music.get_busy()==False: #判断播放器没有正在播放音乐
pygame.mixer.music.play()#播放音乐 pygame.mixer.music.play()#播放音乐
......
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