Commit 8a4032fd by BellCodeEditor

save project

parent 7dddac0b
import pygame
from pygame import locals
pygame.init() # 初始化
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
# 载入图片、资源
......@@ -12,6 +12,9 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load('歌曲4.ogg')
pygame.mixer.music.load('歌曲3.wav')
pygame.mixer.music.load('歌曲2.wav')
pygame.mixer.music.load('歌曲1.wav')
# while True:
......@@ -20,7 +23,10 @@ pygame.mixer.music.load('歌曲4.ogg')
# exit()
volume = 0.2
# pygame.mixer.music.set_volume(volume)
filelist=[while expression:
pass
else:
pass]
start = stop_img
click = 0
while True:
......@@ -40,21 +46,25 @@ while True:
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
if event.button==1:
]
click += 1
if click%2 == 0:
pygame.mixer.music.unpause()
start = stop_img
else:
pygame.mixer.music.pause()
start = play_img
# if volume <=0:
# volume = 0
if pygame.mixer.music.get_busy() == False:
x,y=event.pos
if x>270 and x<370 and y>350 and y<450:
click += 1
if click%2 == 0:
pygame.mixer.music.unpause()
start = stop_img
else:
pygame.mixer.music.pause()
start = play_img
if pygame.mixer.gat_busy()==False:
num+=1
if num>len(filelist)-1:
num=0
pygame.mixer.music.load(filelist[num])
pygame.mixer.music.play()
if volume <=0:
# volume = 0
if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(start, (270, 330)) # 暂停按钮
......
import os
files=os.listdir('C:\\Users\\HW\\Desktop\\test')
print(files)
\ No newline at end of file
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