Commit d8cc12c6 by BellCodeEditor

save project

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