Commit 3159206d by BellCodeEditor

save project

parent d7d7c9c0
Showing with 12 additions and 4 deletions
import os
import pygame
from pygame import locals
......@@ -21,8 +20,8 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
num=-1
music_list=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.ogg"]
path=("C:\\Users\huawei\Desktop")
music_list=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
path=("C:\Users\Kingston\Desktop")
filelist=os.listdir(path)
for i in filelist:
if i[-4:]==".wav" or i[-4:]==".ogg":
......@@ -46,10 +45,10 @@ while True:
# 按下鼠标
if event.type == locals.MOUSEBUTTONDOWN:
# 次数增加
if event.button==1:
x,y=event.pos
if x>270 and x<370 and y>350 and y<450:
# 次数增加
click += 1
if click % 2 == 0:
play_button = stop_img
......@@ -65,3 +64,12 @@ while True:
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
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