Commit be980241 by BellCodeEditor

save project

parent 8c69ba99
Showing with 12 additions and 7 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -13,7 +13,13 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -13,7 +13,13 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load('歌曲4.ogg') pygame.mixer.music.load('歌曲4.ogg')
asdwwwwas = ['歌曲4.ogg','歌曲1.wav','歌曲2.wav','歌曲3.wav'] w = []
qq="C:\\Users\\86130\\Desktop\\text"
l=os.listdir(qq)
for i in l:
if i[-4:]==".wav" or i[-4:]==".ogg":
w.append(i)
a=0.2 a=0.2
pygame.mixer.music.set_volume(a) pygame.mixer.music.set_volume(a)
...@@ -38,9 +44,8 @@ while True: ...@@ -38,9 +44,8 @@ while True:
a=0 a=0
pygame.mixer.music.set_volume(a) pygame.mixer.music.set_volume(a)
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if button == 1: if x>270 and x<370 and y >350 and y<450:
if ades += 1
ades += 1
if ades % 2 == 1: if ades % 2 == 1:
pygame.mixer.music.pause() pygame.mixer.music.pause()
b = play_img b = play_img
...@@ -50,9 +55,9 @@ while True: ...@@ -50,9 +55,9 @@ while True:
if pygame.mixer.music.get_busy()==False: if pygame.mixer.music.get_busy()==False:
m += 1 m += 1
if m > len(asdwwwwas)-1: if m > len(w)-1:
m = 0 m = 0
pygame.mixer.music.load(asdwwwwas[m]) pygame.mixer.music.load(qq+"\\"+w[m])
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