Commit ca67e81c by BellCodeEditor

auto save

parent 73b9448d
Showing with 19 additions and 12 deletions
import pygame
from pygame import locals
import os
#import os
pygame.init() # 初始化
# 创建窗口
......@@ -14,12 +14,13 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test"
filelist = os.listdir(path)
filelist = ['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
#path = "C:\\Users\\小梦\\Desktop\\level3-lesson4-diy4\\歌曲1.wav"
#filelist = os.listdir(path)
num = -1
for i in filelist:
if i[-4:] == ".wav" or i[-4:] == ".ogg":
music_list.append(i)
#for i in filelist:
#if i[-4:] == ".wav" or i[-4:] == ".ogg":
#music_list.append(i)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
......@@ -77,12 +78,18 @@ while True:
else:
click += 1
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
#if pygame.mixer.music.get_busy() == False:
#num += 1
#if num > len(music_list)-1:
#num = 0
#pygame.mixer.music.load(path + "\\" + music_list[num])
#pygame.mixer.music.play()
angle = 0
new_logo = pygame.transform.rotate(logo_img,angle) #旋转图片
angle += 1
newRect = new_logo.get_rect(center=(320,200))
pos = (newRect[0],newRect[1])
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
......
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