Commit 08fa6f7c by BellCodeEditor

auto save

parent 02a9fe5f
Showing with 3 additions and 5 deletions
...@@ -2,9 +2,6 @@ import pygame ...@@ -2,9 +2,6 @@ import pygame
from pygame import locals from pygame import locals
import os import os
filelist = os.listdir("C:\\Users\\lenovo\\Desktop\\test")
print(filelist)
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -16,7 +13,7 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -16,7 +13,7 @@ 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_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = ['歌曲1.ogg','歌曲2.ogg','歌曲3.ogg','歌曲4.ogg'] music_list = []
path = "C:\\Users\\lenovo\\Desktop\\test" path = "C:\\Users\\lenovo\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
for i in filelist: for i in filelist:
...@@ -63,7 +60,8 @@ while True: ...@@ -63,7 +60,8 @@ while True:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(music_list[num]) print(num)
pygame.mixer.music.load(path+"\\"+music_list[num])
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