Commit d8cc12c6 by BellCodeEditor

save project

parent 64c22149
Showing with 15 additions and 9 deletions
File added
import pygame
from pygame import locals
import os
a=0
pygame.init()
screen = pygame.display.set_mode((640, 480))
......@@ -13,13 +13,16 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = []
path = "C:\\Users\\Administrator\\Desktop\\tast"
filelist = os.listdir(path)
music_list = ["a.mp3"]
#path = "C:\\Users\\Administrator\\Desktop\\tast"
#filelist = os.listdir(path)
num = -1
'''
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
......@@ -57,7 +60,7 @@ while True:
num += 1
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.load( music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
......@@ -69,25 +72,28 @@ while True:
num -= 1
if num < 0:
num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
click += 2
else:
click += 1
new_img=pygame.transform.rotate(logo_img,a)
new_rect=new_img.get_rect(center=(320,200))
pos=(new_rect[0],new_rect[1])
a+=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.load( music_list[num])
pygame.mixer.music.play()
new_logo = pygame.transform.rotate(logo_img, angle)
angle += 1
screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330))
screen.blit(logo_img, (170, 60))
screen.blit(new_img,pos )
screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350))
......
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